Log in

View Full Version : User Image Upload



mburt
11-10-2006, 12:55 AM
I was wondering how I could let the user upload a an image to my ftp server, I was thinking of using ftp functions, but it didn't work.

I would have a text field on the previous page with the file src in it.
Something like

$src = $_POST['image_src'];

then I want to be able to upload it to the server.

Thanks in advance,
Mike

motormichael12
11-10-2006, 01:52 AM
is the folder it is in set to chmod 777?

here is a script I have for a forum board I am creating, it is for uploading an avatar... you can pick out the bits you need.


if ($_POST['remoteavatar'] || $_FILES['uploadavatar']['tmp_name']) {


$message=$_POST['remoteavatar'];

if($avatar_upload_allowed=="Yes") {

if($_FILES['uploadavatar']['tmp_name']) {

$uploadin=1;

$folder = "./uploads/";
$temporary = $_FILES['uploadavatar']['tmp_name'];

motormichael12
11-10-2006, 01:54 AM
or try looking at php image gallery scripts

ItsMeOnly
11-10-2006, 10:07 PM
The form


<form enctype="multipart/form-data" method="post" action="uploading.php"
name="form" id="form">
<input name="pic" id="pic" type="file">
</form>
And uploading:


if ($_FILES['pic']['size']) {
if (!file_exists("$imagepath")) mkdir("$imagepath", 755);
move_uploaded_file($_FILES['pic']['tmp_name'], "$imagepath/". $_FILES['pic']['name']);
}