Re: File uploading?

From: Date: Wed, 31 Jan 2001 16:39:07 +0000
Subject: Re: File uploading?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37509@lists.php.net to get a copy of this message
Lauri, supposing you name the file input tag "myfile" (like <INPUT NAME="file" TYPE="myfile">), then $myfile contains the name of the temporary file on the server, while $myfile_name contains the filename on the client's system. See also http://www.php.net/manual/en/features.file-upload.php Drop me a line if you are still stuck, Ben Lauri Vain wrote: > > Hello everybody, > > I'm trying to do a file upload from the users computer via HTML file form element > to a Linux server running Apache. The file is selected by the user from her > or his computer, they hit the submit button and the file goes to /print/ folder > (dir relative to uploading script on the server). I use the following code: > > > /**************************Upload'i file*********************/ > function upload($file) > { > $name = split("\\\\",$file); // Get filename > $name = end($name); > > $fd = fopen($file, "w+"); /*BTW, this is line 12 */ > $filedata = addslashes(fread($fd, filesize($pilt))); > fputs("/print/$name", stripslashes($filedata)); > fclose($fd); > > /*copy($file,"print/".$name); Kopeeri fail kausta > fputs($fp, $header); > fclose($fp); > unlink($file);*/ > return $name; > } > /**************************Upload'i file*********************/ > > I get the following error code: > /******************** ERROR *****************************/ > Warning: fopen("C:\\Data\\Lauri\\Selja_seadused.doc","w+") - Permission > denied > > in /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 12 > > Warning: Supplied argument is not a valid File-Handle resource in > /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 13 > > Warning: Supplied argument is not a valid File-Handle resource in > /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 14 > > Warning: Supplied argument is not a valid File-Handle resource in > /home/saue/public_html/oigusaktid/funktsioonid.php3 on line 15 > /******************** ERROR *****************************/ > > Thanks for your help in advance! > > Yours truly, > Lauri > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#37509) next »