Forum Moderators: phranque

Message Too Old, No Replies

File uploading:

How to upload a file from the webpage to the server.

         

Faction5

1:03 am on Mar 28, 2006 (gmt 0)

10+ Year Member



I've been trying figure out how to add a feature to my website. I want it where I can upload an image and it is directly sent to the server and uploaded to the webpage. I know how to send a file through a form and over to an email address, but I need it like profile websites have, something like that. Any help would be very appreciative. Thanks.

txbakers

1:43 am on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi and welcome to the Webmaster World.

To upload an image to the server requires a bit of server side coding, whether in PHP, ASP or whatever you have available. there are components available to help you do this.

But, once the file is on the server, you need some way of tracking it, and getting the picture to appear on the web page dynamically. Most likely you'll need some type of database solution as well.

it's very tricky.

Faction5

4:54 am on Mar 28, 2006 (gmt 0)

10+ Year Member



I know a good amount of PHP, I'm just stumped as to how I can upload it to the server from the webpage, instead of having to go through FTP manually everytime.

txbakers

11:43 am on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't have to load it to the webpage, you need to code it so the web page can find it.

Here's what I do:

1) Upload the Image to the Server
2) If already there, replace it
3) Read the Database, look for the title of the file
4) If there, replace/update, if not, INSERT.
5) On the web page, I have a DB recordset reading all records for that item
6) If there are records/images, I display them in a certain order all with variable names.

Even in reading this I can see the complexity of the task. It's not easy and requires step by step care.

Faction5

8:31 pm on Mar 28, 2006 (gmt 0)

10+ Year Member



Well, here's the problem, in step one you say to load it to the server, but I want to load it to the server via the webpage. So anyone could actually load their picture to the server without having to use the FTP or any other program. After it's been uploaded, then it shouldn't be too hard to tell the webpage where to find the image.

txbakers

8:46 pm on Mar 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



as I said earlier:
To upload an image to the server requires a bit of server side coding, whether in PHP, ASP or whatever you have available. there are components available to help you do this.

You need to look for server side scripts or components to do this for you.

In ASP, I use a component called ASPUpload, which has the code needed to process uploading items.

You need to search the PHP script repositories and see what you can find. Try Googling "PHP Image Upload" and see what shakes.

Faction5

12:09 am on Apr 4, 2006 (gmt 0)

10+ Year Member



I got it all coded then after I click the Submit button this is written:
Warning: copy(http://www.universalwebproductions.com001h.gif): failed to open stream: HTTP wrapper does not support writeable connections. in /home/breland/brelandwebdesigning-www/imageupload.php on line 24
upload failed!
What in the world does this mean?