0

this might be a bit of a novice question and here is my situation:

i have a upload form for uploading images. and in my editAction i do:

if ($request->isPost()) {
            if (isset($_POST['upload_picture']) && $formImageUpload->isValid($_POST)) {
                //here i will add the picture name to my database and save the file to the disk.
            }
}

$picVal = $this->getmainPic(); // here i do a simple fetch all and get the picture that was just uploaded

$this->view->imagepath = $picVal;

what happens is that the newly uploaded picture doesn't show. I checked the database and the dick and the file is there.

im thinking the problem might be the order of the requests or something similar.

any ideas?

edit: another thing is that in order to make the new image come up i have to do a SHIFT+F5 and not only press the browser refresh button

edit2: more code

i first call the upload to disk function then if that returns success addthe file to the database

$x = $this->uploadToDiskMulty($talentFolderPath, $filename)

if($x == 'success'){
    $model->create($data);
}

the upload function

public function uploadToDiskMulty($talentFolderPath, $filename)
{
    // create the transfer adapter
    // note that setDestiation is deprecated, instead use the Rename filter
    $adapter = new Zend_File_Transfer_Adapter_Http();
    $adapter->addFilter('Rename', array(
            'target'    => $filename,
            'overwrite' => true
    ));

    // try to receive one file
    if ($adapter->receive($talentFolderPath)) {
        $message = "success";
    } else {
        $message = "fail";
    }

    return $message;
 }
2
  • what is in your $model and in your $data ? Commented May 7, 2012 at 23:18
  • $model = new Picture_Model_Create(); and $data is the picture name Commented May 7, 2012 at 23:20

1 Answer 1

1

If the picture only appears when you do SHIFT+F5 that means it's a caching problem. Your browser doesn't fetch the image when you upload it. Do you use the same file name?

Sign up to request clarification or add additional context in comments.

2 Comments

just add a "?<random_number>' to the end of the image name. This causes the browser to think it's new un-cached content and it'll fetch it again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.