PHP FTP image upload
antonysmith said 1 year, 1 month ago:
I’m having an issue with my script uploading to GoDaddy. It works perfectly fine on my dev machine.
Could you take a look:
<?php
$path = “uploads/”;
$valid_formats = array(“jpg”, “png”, “gif”, “bmp”);
if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == “POST”) {
$name = $_FILES['photoimg']['name'];
$size = $_FILES['photoimg']['size'];
if(strlen($name)) {
list($txt, $ext) = explode(“.”, $name);
if(in_array($ext,$valid_formats)) {
if($size<(1024*1024)) {
$actual_image_name = time().substr(str_replace(” “, “_”, $txt), 5).”.”.$ext;
$tmp = $_FILES['photoimg']['tmp_name'];
if(move_uploaded_file($tmp, $path.$actual_image_name)) {
echo “<img src=’uploads/”.$actual_image_name.”‘ class=’preview’><p>”.$actual_image_name.”</p>”;
} else
echo “failed”;
} else
echo “Image file size max 1 MB”;
} else
echo “Invalid file format..”;
} else
echo “Please select image..!”;
exit;
}
?>
sherrod said 1 year, 1 month ago:
@antonysmith,
Is there an actual error that is being listed when utilizing this? If so please reply back with the URL so we can review this further.
It may also be related to the Upload limit within the initialization file. The following may help:
What is the PHP upload limit on Linux Shared Hosting accounts?
Sherrod
antonysmith said 1 year, 1 month ago:
Update: I just looked at the FTP File Manager and added Web User Permissions ‘Write’ but its still not working. I guess its not a server side issue.
antonysmith said 1 year, 1 month ago:
I’m using an Ajax script I found on the internet http://www.9lessons.info/2011/08/ajax-image-upload-without-refreshing.html (Without the mysql database stuff) so its not returning an error.
I’m attempting to upload an image that’s 1.70 KB .png with dimensions of 32 x 32 px. It cant be the file size.
The url for the user interface is http://thedarkestday-themovie.com/ADMIN/update_news.php which is currently password protected.
antonysmith said 1 year, 1 month ago:
Why do my reply’s never appear immediately?
antonysmith said 1 year, 1 month ago:
Any update on this issue? Is GoDaddy looking into my issue?
Cheers
JasonP said 1 year ago:
@antonysmith
I apologize for the delay in getting a response to you. Quick answer for the delay in your posts being seen: All posts are held for moderation.
Have you been able to resolve the issue?
Jason
8 min expected wait time