tim3011's avatar

file Upload Not working with laravel on android device

I happen to have a multi data form with image upload and that won't work with android devices changed my form to raw PHP and it works fine what am I missing as a plug in my laravel application for this to work within laravel frame work.

<?php

namespace App\Http\Controllers;

use App\Http\Requests;
use Request;
use Illuminate\Support\Facades\Input;
use Validator;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use DB;
use Auth;
use Illuminate\Support\Facades\Redirect;
use Session;
use Carbon\Carbon;

class TestController extends Controller
{
 if (Input::file('picture')->isValid()) {
     $destinationPath = 'uploads'; // upload path
      $extension = Input::file('picture')->getClientOriginalExtension(); // getting image extension
     $fileName = rand(11111,99999).'.'.$extension; // renameing image
      Input::file('picture')->move($destinationPath, $fileName); // uploading file to given path
     

            
               $spotCheckImage = new SpotCheckImagePath();
                 $spotCheckImage->imgname =  $fileName;
                 $spotCheckImage->imagepath = 'uploads/'. $fileName;
                 $spotCheckImage->spotCheckComment()->associate($spotCheckComment);
                $spotCheckImage->save();
 // sending back with message
      Session::flash('success', 'Records Saved successfully'); 
      return Redirect::to('testform');
    }
}
   
0 likes
3 replies
helrigle's avatar

I'm having the exact same problem... did you ever find a solution?

gbvacco's avatar

Just found the source of my problem! I was testing on my macbook after move the application to a linux server the upload works perfectly!

Please or to participate in this conversation.