file upload

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,

I've got some problems uploading files using apache and php on a local
Windows PC. I'm using the file upload example from the manual, but i
can't get it to work. I don't get an error message, it's asif nothing
happens. I can't find the file that should be uploaded on my harddisk.

Has anyone a working example for file-uploads on a local server with
the settings for the php.ini file? Any tips?

Thanx a lot!

Re: file upload

Quoted text here. Click to load it

Please clarify your question.

1. Are you uploading the file from one directory on your hard drive to
another directory on your hard drive?


2. Are you uploading the file from one directory on your hard drive to a
directory on the internet server not on your computer?


Re: file upload

Quoted text here. Click to load it

The first option. Because i didnt know where to expect the file, I
searched the whole harddisk, but I cant find the file. I wonder if
anyone has a working example for a local server, if i can get it to
work it locally, i hope it wont be too hard to get it to work on the


Re: file upload

This is how I do it.  If this does not work, get back to me.

I have a possible 10 images to store.

I previously renamed the images with the session_id number and the original
ext.  file_sessionid-name.$i (file name to be moved)  Not necessary, just my
way of tracking the images.

The hard drive directories:
 $_SESSION['archive_dir_temp'] = "C:\Apache
Group\Apache2\Wisconsin\uploadtemp\";               //original directory
 $_SESSION['archive_dir_move'] = "C:\Apache
Group\Apache2\Wisconsin\uploaddir\";                  //final directory

The script:
$file_id = session_id();

 for ($i=1; $i<=10; $i++) {
   if ($_SESSION['picture_name'.$i] !="")
{                                           //check to see if a file exists
     $filename = basename($_SESSION['picture_name'.$i]);                  //
remove directory information
//pick off extension
//session id number.-1.extension
      die("Failed to copy".$_SESSION['picture_name'.$i]."<br><br>");
      $_SESSION['file_sessionid_name'.$i] =$file_sessionid_name;

Another way:
                    original directory                  original file name
new directory                             new file name

//  $filename = original file name
//  file_sessionid_name   the new name for the file
@ eliminates error messages.  I suggest you take it out while working on the
script.  After the script works, add it in.

Hope this helps.
I am sure there are easier way to accomplish the move.  I wanted to track
the changes in other parts of the program, so I did it this way.

Site Timeline