View Full Version : Upload field ..?


-char-
02-07-2005, 08:19 PM
well I want to add an upload field to my form. so, for example, if I asked; "what does your favourite cat look like?" and allows them to upload a picture and then send it to me using a php form.
I use bravenet free forms, so would it work with this too?? char xox

dudepet39
02-08-2005, 05:27 PM
You could just make a field saying Picture URL goes here:



--------------------------------
Pic URL here: | http://www.blah.com/picture.gif|
--------------------------------

(sorry its a bad example of a box, :P).

Hope that helps,

-Brandon

bejayel
02-08-2005, 05:28 PM
http://www.inebria.com/phpftp/ftp.txt

this is a big time upload script using php as an ftp client.

http://www.devarticles.com/c/a/PHP/Creating-a-MultiFile-Upload-Script-in-PHP/

this is a simple multi file upload script.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Upload File</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<?php

//Check first if a file has been selected
if (is_uploaded_file($_FILES['uploaded']['tmp_name']))
{

//Get the Size of the File
$size = $_FILES['uploaded']['size'];

//Make sure that $size is less than 100MB
if ($size > 100000000)
{

//Print the error
echo 'File Too Large. Please try again.';
exit();

}

//Move the File to the Directory of your choice
if (move_uploaded_file($_FILES['uploaded']['tmp_name'],'uploads /'.$_FILES['uploaded']['name']));

//Include the Next Page
include 'upload_complete.htm';
exit();

}
else
{

//Print error
echo 'Unable to move the File';
exit();

}
}
else
{

//Print error
echo 'No File Selected';
//Include the Form
include 'formpage.php';
exit();

}

?>

</body>
</html>


i havent seen this one at work, but it looks like it would be good as well.

Computer_Girl13
02-09-2005, 07:32 PM
well I want to add an upload field to my form. so, for example, if I asked; "what does your favourite cat look like?" and allows them to upload a picture and then send it to me using a php form.
I use bravenet free forms, so would it work with this too?? char xox

If I understand correctly, an upload field *doesn't* send the files along with your email, though I'm sure you could probably find a script or something that did. The files are stored on the server in a certain location. I'm not sure where, but you probably couldn't use them with bravenet.

To add an upload field to a form, you type:
<input type="files" name="cat_pic" size="40">

Also, if you're going to try and use this, you should get an upload filter to restrict the types of files you're going to have uploaded, just for a bit more protection. You can get this at http://javascript.internet.com/forms/upload-filter.html
Have fun!

-char-
02-09-2005, 09:23 PM
thanks Computer_Girl13, but if I was using geocities, or freewebs, how would I then use it? If you see what I mean, because the code uploads it to cgi-bin/some-script.cgi
and I wouldn't know how to use that :S argh

kittycat
02-09-2005, 09:37 PM
You couldn't use anything like that with geocities.
What you might be able to do is what dudepet suggested. Make an input field where they can stick the URL to the photo if it's online, and if it's not online they can upload it to some place like tinypic.com and give you that URL. With geocities you're limited in solutions for that question.

-char-
02-12-2005, 09:13 AM
Thanks soo much for all your help guys, I used dudepet's suggestion, and it worked ok :D xx