File upload from Form

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

Threaded View

 I have a simple form which is supposed to upload a file to my server from a
local machine, appears to when submitted from the local machine, but nothing
appears on my server (Apache Linux). Can anyone point me in a direction to
trying to discover why? Thanks, Ike
        <html><head><title>Select Backup File</title></head>
        <form  method="post" action="restore.php"
            Enter File name:
            <input type="file" name="./ggrip_testdb" >   <p><p>
            <input type="submit" name="btnSubmit" value="Restore">

Re: File upload from Form

And lo, Ike didst speak in alt.www.webmaster:

Quoted text here. Click to load it

Hello Ike, how's Mike?  *chuckles*

Anyway, you're submitting this form to a file called "restore.php".  Just  
submitting the file won't put it on your server; this PHP script will need  
to accept the incoming file data-stream and choose a place to put it.  If  
you don't actually save it somewhere, PHP saves it to a temporary  
directory which it is free to clear out whenever it decides it doesn't  
actually *like* your uploaded Barry Manilow mp3's.

Take a look at the "Handling File Uploads" section of the PHP  
documentation.  It's really a simple process, but even I forget some of  
the steps from time to time.



The technical axiom that nothing is impossible sinisterly implies the  
pitfall corollory that nothing is ridiculous.
- - Orca Ringmaker: Host a web ring  
 from your website!

Re: File upload from Form

Ahhhh, thank you!

Re: File upload from Form

Ike wrote

Quoted text here. Click to load it

I use this in PHP:

copy ("uploaded file","destination");

You wouldn't put the filename in the name"" attribute above as you have

I would have this:

<input type="file" name="local_file">

Then in restore.php I would have this:


You will probably also need to make the destination directory write-
able, CHMOD.

Charles Sweeney

Site Timeline