Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is code:

<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width: 270px; height: 270px;">
<img src="http://localhost/storage/images/moimage.gif" />
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 270px; max-height: 270px; line-height: 20px;"></div>
<div>
<span class="btn btn-file"; style="width:100%">
<span class="fileupload-new"><?php echo __('site.select_image'); ?></span>
<span class="fileupload-exists"><?php echo __('site.change'); ?></span>
<input type="file" name="image" />
</span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Delete</a>
</div>
</div>

This is action:

if(Auth::can('upload_item_images'))
{
if(is_numeric($id) && Input::file('image.name') !== '')
{
$path = Config::get('application.upload_path') . DS . 'users' . DS . 'images' . DS .
$id . '.' . File::extension(Input::file('image.name'));
Bundle::start('resizer');
$success = Resizer::open(Input::file('image'))
->resize( 500 , 500 , 'crop' )
->save( $path , 90 );
}
}

This is application upload_path: 'upload_path' => path('public') . 'images'

I would like to save the image in images/users/images but when I upload a image it shot out a message that is successfully done but for actually images was not added to the server.

share|improve this question

1 Answer 1

You have to save image to server before processing .

if(Auth::can('upload_item_images'))
{
if(is_numeric($id) && Input::file('image.name') !== '')
{
$path = Config::get('application.upload_path') . DS . 'users' . DS . 'images' . DS .
$id . '.' . File::extension(Input::file('image.name'));
Bundle::start('resizer');
$name = Input::file('image')->getClientOriginalName();
Input::file('image')->move($name);
$success = Resizer::open($name)
->resize( 500 , 500 , 'crop' )
->save( $path , 90 );
}
}
share|improve this answer
    
I tried but still the same, there is no file on the server. –  Alex Mar 26 at 10:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.