Remember, that open_basedir affects this function. You will get an error:
Warning: tmpfile() [function.tmpfile]: open_basedir restriction in effect. File(/var/tmp) is not within the allowed path(s): ....blablabla =)
![]() |
|
||||||||||
|
tmpfileОписаниеresource tmpfile ( void )Создаёт временный файл с уникальным именем, открывая его в режиме чтения и записи (w+), и возвращает файловый указатель таким же образом, как это делает fopen(). Этот файл автоматически удаляется после закрытия (использования fclose()) или после завершения работы скрипта). Для дополнительной информации, обратитесь к документации вашей системы по функции tmpfile(3), а также к заголовочному файлу stdio.h.
См. также описание функции tempnam(). tmpfile
o_O Tync
20-Apr-2007 10:26
Remember, that open_basedir affects this function. You will get an error:
oremanj at gmail dot com
08-Apr-2007 11:46
No, the fseek() is necessary - after writing to the file, the file pointer (I'll use "file pointer" to refer to the current position in the file, the thing you change with fseek()) is at the end of the file, and reading at the end of the file gives you EOF right away, which manifests itself as an empty upload.
zlynx at acm dot org
13-Mar-2007 06:02
I am fairly sure that the seek just flushes the data from the memory buffers to the file. fflush() should give you the same effect.
05-Sep-2006 11:53
By the way, this function is really useful for libcurl's CURLOPT_PUT feature if what you're trying to PUT is a string. For example:
03-Aug-2006 06:05
fseek() is important because if you forget about it you will upload empty file...
chris [at] pureformsolutions [dot] com
04-Oct-2005 12:14
I found this function useful when uploading a file through FTP. One of the files I was uploading was input from a textarea on the previous page, so really there was no "file" to upload, this solved the problem nicely: |