Jump to content

Image Upload size issue


chasethemetal

Recommended Posts

Hey there so I'm using the below code to upload images/files to my server via ftp. The issue I've found is that anything bigger than 200KB either stalls out and partially uploads or doesn't upload at all.

 

I've set my php.ini file to have upload_max_filesize = 1000M and post_max_size = 1000M. And still anything bigger than 200KB won't upload right. Any help would be appreciated. I'm using php version 5.2.14 fyi. Thanks so much.

 

 

---CODE---

<?if(!isset($_POST["submit"])){?>

 

<!-- THE FORM ACTION IS ONTO ITSELF -->

<form action="index.php" method="POST" enctype="multipart/form-data">

<input name="userfile" type="file" size="40">

<input type="submit" name="submit" value="Upload image" />

 

</form>

 

<?

}

else

{

 

set_time_limit(30000);//i noticed that this had to be pretty big otherwise your upload was likely to stall out.

 

$paths='/yourfilepath/yourfilepath/';

 

$filep=$_FILES['userfile']['tmp_name'];

 

$ftp_server='ftp.yourdomain.com';

 

$ftp_user_name='your_user_name';

 

$ftp_user_pass='your_password';

 

$name=$_FILES['userfile']['name'];

 

 

 

$conn_id = ftp_connect($ftp_server);

 

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

 

if ((!$conn_id) || (!$login_result)) {

echo "FTP connection has encountered an error!";

echo "Attempted to connect to $ftp_server for user $ftp_user_name....";

exit;

} else {

echo "";

}

 

$upload = ftp_put($conn_id, $paths.'/'.$name, $filep, FTP_BINARY);

 

if (!$upload) {

echo "FTP upload has encountered an error!";

} else {

echo "Uploaded file with name $name Succsessfully ";

}

 

ftp_close($conn_id);

 

}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.