hi all,
I hope u all enjoying happy lives. my problem is that I want to upload
images to a specific folder n for uniqueness of image name i append time()
with image name. and these images are related to different gadgets. when I
want to edit the gadget and change its image then older image for that
gadget will remove and new one will be uploaded. I have achieved all these
on my local server. but when i uploaded n deploy the application. then when
i upload an image. its not uploaded with its unique name rather it uploaded
with its original name and when i edit gadget and change its image then
older one is not deleted. whats the problem. code is given below;
for uploading;
$fname = $form->getValue('pic');
$fnam = time() . $fname;
$ffname = realpath(UPLOAD_PATH).'/'.$fname;


$filename = realpath(UPLOAD_PATH).'/'.$fnam ;


copy($ffname, $filename);
unlink($ffname);
when edit following code works:

$picc = $form->getValue('pic');
if($picc){

$fnam = time() . $picc;
//echo $fnam;exit;
$ffname = realpath(UPLOAD_PATH).'/'.$picc;


$filename = realpath(UPLOAD_PATH).'/' .$fnam ;

copy($ffname, $filename);
unlink($ffname);

$gadget = new Model_DbTable_Gadget();
$gadget = $gadget->editGadget($idd);
$oldpic = $gadget['path'];
$dpath = realpath(UPLOAD_PATH).'/'.$oldpic;
unlink($dpath);

plz help me..... 
-- 
View this message in context: 
http://www.nabble.com/image-upload-problem-tp26093110p26093110.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to