Can't find the images uploaded by php script


I have write a script to allow the users upload the images to the server, the script works fine on local environment and images are uploaded to tmp folder first then moved to specific location after. But when i live the site and users have uploaded there pictures, but that are not uploaded properly, only the images names that are coming from the database. I also checked the tmp folder is not created on the live serve. How i can recover those images, where that are gone ?

Here is the code snipet

$absolutedir        = dirname(__FILE__);
$dir                        = '/tmp/';
$serverdir          = $absolutedir.$dir;
$tmp    = explode(',',$_POST['data']);
$imgdata                = base64_decode($tmp[1]);

$explosion = explode('.',$_POST['name']);
$exlosion = explode('.',$_POST['name']);
$end_of_explosion = end( $explosion );
$extension          = strtolower($end_of_explosion);
$filename   = basename(substr($_POST['name'],0,-(strlen($extension) + 1))).'.'.substr(sha1(time()),0,6).'.'.$extension;
$handle = fopen($serverdir.$filename,'w');
fwrite($handle, $imgdata);



you probability find that file on DOCUMENT_ROOT. i don't know externally reason. but i had a same issue and files are created on DOCUMENT_ROOT. or if your code is on Linux based system just make sure permission table are configured correctly?

this is just hunch not a perfect solution.

People are also looking for solutions to the problem: javascript - Html form refuses to be submitted via JQuery


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.