note 74387 added to function.tmpfile

From: Date: Mon, 09 Apr 2007 06:46:17 +0000
Subject: note 74387 added to function.tmpfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-125235@lists.php.net to get a copy of this message
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. Where you might be getting confused is in some systems' requirement that one seek or flush between reading and writing the same file. fflush() satisfies that prerequisite, but it doesn't do anything about the file pointer, and in this case the file pointer needs moving. -- Josh ---- Server IP: 64.71.164.2 Probable Submitter: 64.161.78.226 ---- Manual Page -- http://www.php.net/manual/en/function.tmpfile.php Edit -- https://master.php.net/note/edit/74387 Del: integrated -- https://master.php.net/note/delete/74387/integrated Del: useless -- https://master.php.net/note/delete/74387/useless Del: bad code -- https://master.php.net/note/delete/74387/bad+code Del: spam -- https://master.php.net/note/delete/74387/spam Del: non-english -- https://master.php.net/note/delete/74387/non-english Del: in docs -- https://master.php.net/note/delete/74387/in+docs Del: other reasons-- https://master.php.net/note/delete/74387 Reject -- https://master.php.net/note/reject/74387 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125235) next »