Bartłomiej Semańczyk Bartłomiej Semańczyk - 1 year ago 204
PHP Question

"Server error. Upload directory isn't writable."

I use

script to upload images on server. This is the code I use from localhost

require 'FineUpload.php';

$uploadDir = '';
$allowed = explode(',', 'pdf');
$sizeLimit = 5000 * 1024;

$fineUpload = new FineUpload($allowed, $sizeLimit);
$response = $fineUpload->handleUpload($uploadDir);

if (@$response['success']) {
$uploadName = $fineUpload->getUploadName();

list($width, $height) = getimagesize($uploadDir . $uploadName);

$response['fileName'] = $uploadName;

echo json_encode($response);

I have created a
directory in
directory, but still gets the error:

{"error":"Server error. Upload directory isn't writable."}

Answer Source

Your upload directory must be a local folder relative to your current dir and not a web url. Try getcwd() to know which folder you are in and then use a relative path to your gallery folder.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download