Seems to me that space in the file copy is what's causing problems. Try
changing "ads/ $File_name" to "ads/${File_Name}".
Just a note that doing things that way can cause big problems,
especially on unix systems.. imagine if you went to your website and type:
http://site/index.php?File=%2Fetc%2Fpasswd&File_name=hacked.txt
Also instead of copying then unlinking the file, you can avoid the above
problem by using move_uploaded_file().
See the documentation for this command here:
http://www.php.net/manual/en/function.move-uploaded-file.php
Mike
Tgl wrote:
> I got the file to upload to my folder. But when I go to download it to my PC
> using FTP, it tells me NO SUCH FILE, but I can see it in the folder. The
> folder has read, write, execute permissions. I included the script below.
>
> I would appreciate any help.
>
>
>
>
> <HTML>
> <HEAD>
> <TITLE>Advertisement Application</TITLE>
> </HEAD>
> <BODY>
> <?php
> error_reporting(E_ALL);
> /* This next conditional determines whether or not to handle the form,
> depending upon whether or not $File exists. */
> if (isset($File)) {
> print ("File name: $File_name<P>\n");
> print ("File size: $File_size<P>\n");
> if(copy ($File, "ads/ $File_name")) {
> print ("Your file was successfully uploaded!<P>\n");
> } else {
> print ("Your file could not be copied.<P>\n");
> }
> unlink ($File);
> }
>
> print ("Upload a file to the server:\n");
> print ("<FORM ACTION=\"ad_app.php\" METHOD=POST
> ENCTYPE=\"multipart/form-data\">\n");
> print ("File <INPUT TYPE=FILE NAME=\"File\" SIZE=20><BR>\n");
> print ("<INPUT TYPE=SUBMIT NAME=\"SUBMIT\" VALUE=\"Submit!\"></FORM>\n");
> ?>
> </BODY>
> </HTML>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php