Domanda

Here is a werid one:glitchburger

That is supposed to be a picture of a hamburger. That's cool, but I need it to be a hamburger after I upload it too, or the client will be mad.

I am using laravel 4 and nothing too special. Below is my code, more or less cribbed from a tutorial somewhere - any ideas what is going on? I am not really able to fire up another hosting environment to test in, unfortunately.

upload form:

{{ Form::open(array('url'=>'/manage/photos/upload', 'class'=>'form-signin',  'files' => true)) }}   
    {{ Form::file('image') }}
    {{ Form::submit('Upload Photos', array('class'=>'btn btn-large btn-primary btn-block'))}}
{{ Form::close() }}

file receiving code in my controller:

    public function uploadPhoto() {
        $file = Input::file('image');
        $input = array('image' => $file);
        $rules = array(
            'image' => 'image'
        );
        $validator = Validator::make($input, $rules);
        if ( $validator->fails() )
        {
            return Redirect::to('/manage/photos')->with('message', 'There was a problem:');
        } else {
            $destinationPath = 'profileimages';
            $filename = uniqid('', true).'.jpg';    
            Input::file('image')->move($destinationPath, $filename);

            return Redirect::back()->with('message', 'The photo was successfully uploaded');
        }
    }

any ideas?

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top