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
https://forums.phpfreaks.com/topic/236277-image-upload-size-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.