dropzone and laravel, filename is getting numbers prepended to it

  dropzone.js, laravel, php

I’m using dropzone and laravel in order to upload images to aws and save the filename in the database. The problem is that it saves the filename to aws as a bunch of numbers before the filename of the uploaded file. In other words, if I upload blueSquare.png it comes into aws as 102472349837blueSquare.png

In the controller code that uploads, I dumped the filename to see what’s going on and it shows the filename as php701f.tmp:

        $file = $request->file('file');
        dd($file->getFileName()); //this dumps php701f.tmp
        $extension =  $file->getClientOriginalExtension();
        $originalName = $file->getClientOriginalName();
        $path = $dir.DIRECTORY_SEPARATOR.$originalName;
        $url  = 'https://test.s3.amazonaws.com/'.$path;

How can I get it to just upload the blueSquare.png filename to aws?

Source: Laravel StackOverflow

Leave a Reply