Ive been building a rather large image manipulation website using php / imagick, and for a long time ive had a function working that would upload posted files to the server. It has now decided (6 hours before due) that it doesn't want to accept any more uploads.
I'm thinking it has got something to do with output buffering or file caching of some description at the server side (I really dont know much about these). I've checked that the input types and formats are all the same as what they have been normally, and yet no dice.
Furthermore, I even went back and tried to create a very basic upload page just to test that, and even it doesn't work. Code below is for the basic upload page, i dont think theres anything wrong with it.
HTML:
<form action="" method="POST" enctype="multipart/form-data" >
<div class="">
<input type="text" name="title" /><br />
<input type="text" name="album" /><br />
<textarea cols="40" name="description" ></textarea><br />
</div>
<img class='' src='images/assets/upload/browse.png' /><br />
<input class='' type="file" name="image" value="" />
<input class ="" type="submit" name="upload" value="" />
PHP
<?php
//include 'includes/beginpage.php'; //include 'methods/usermethods.php';
if(isset($_POST['submit'])){
// Example of accessing data for a newly uploaded file
$fileName = $_FILES["file"]["name"];
$fileTmpLoc = $_FILES["file"]["tmp_name"];
// Path and file name
$pathAndName = "Users/".$fileName;
// Run the move_uploaded_file() function here
$moveResult = move_uploaded_file($fileTmpLoc, $pathAndName);
// Evaluate the value returned from the function if needed
if ($moveResult == true) {
echo "File has been moved from " . $fileTmpLoc . " to" . $pathAndName;
} else {
echo "ERROR: File not moved correctly";
}
} ?>
I'd greatly appreciate any help anyone can give me.
Cheers, Sean
EDIT:
Turns out somehow it has to do with access permissions when creating folders on linux. Ill look into it later, but have just got a temp measure in place for now - create the folders manually.
Thankyou to Michael W for such quick response, helping me find those server logs helped me find the problem
Upon checking the error logs on my server I saw a few lines that referred to an Imagick error. After about 5 minutes on Google the general idea seemed to be that Imagick was restricted from accessing a resource. In my case, the resource didn't actually exist.
I needed to fix some code elsewhere regarding the creating of a directory in the root location on the server for those site files, using the whole 'umask' workaround. I tested and got the site to work correctly with the mkdir() method, tried again and it all worked perfectly. Thanks again to Mike W for the hint on the server logs, I wouldn't have even thought to check there!