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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to