...

View Full Version : I need people to be able to Upload Images to my website



KellyJane
05-11-2004, 07:43 PM
I'm new to coding and need help!

I just need people to be able to upload an image or images to my site. I've found that I need to use a FileField Object but I'm not sure how to set this all up so it actually functions.

Does anyone have a quick explaination or an example I could work from?? Any help would be greatly appreciated!

Thanks so much!
Kelly Jane
:confused:

Roy Sinclair
05-11-2004, 07:57 PM
Cross posted: http://www.codingforums.com/showthread.php?t=38419

l3vi
05-11-2004, 08:44 PM
This would require a php script. You need to first install a local webhost on your network. I would suggest Abyss (http://www.aprelium.com) Web Server. Then you need to download the php windows binaries and install them. You can get these from www.php.net . After you install those, you need to configure Abyss Web Server, then create your php script.



<?php

$file = $_POST['file'];
$to = "./uploads";

$msg = "Your file, $file, was uploaded successfully to the directory $to!";
$ermsg = "Your file, $file, could not be uploaded to the directory $to!";

if (copy ($file, $to)){
print("$msg");
}else{
print("$ermsg");
}

unlink ($file);

?>


This is some code that may work for what you want. You do have to edit the variables, and in your form, name the file input, "file".

KellyJane
05-11-2004, 10:46 PM
Is there any simpler way? Such as creating a form with an action that will upload the file into a folder I create??

l3vi
05-12-2004, 12:13 AM
Is there any simpler way? Such as creating a form with an action that will upload the file into a folder I create??

Nope. You could also get a free web server (good one at www.codes4u.com I think), and upload your files there. But in your form, your form, you would creat ethe form tags something like this:

<form method="post" action="./*THE PHP FILE*.php">

*FORM CODE HERE*

</form>

That is the only way to upload files. You must use a server side script such as php. You can get more information on the php coding language at http://www.php.net, and I great starter book that I recommend would be:

PHP for the world wide web
By Larry Ullman
ISBN: 0-201-72787-0

If your willing to spend $20 to learn it.. :D

missing-score
05-12-2004, 12:47 AM
This isnt entirely true, I believe you can use a form, and use the mailto: method, however this isnt really the best way to go compared to a server side script.

KellyJane
05-12-2004, 11:10 PM
Thank you for your help! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum