Browse AI Field GuideForum Podcast
All ThreadsLeaderboard
  1. Discussions

    1. Popular This Week
    2. Popular All Time
    3. Solved
    4. Unsolved
    5. No Replies Yet

nghquangy's avatar

laravel 5.4 + Vuejs 2.0, vue resource work on localhost, errors on host? MethodNotAllowedHttpException 405 (Method Not Allowed)

i run app woking on local but i uploaded on host after i get errors. My controller Route::group(['middleware'=>['auth']],function (){ // upload file Route::post('/api/upload','UploadController@store'); Route::post('/api/upload/image','UploadController@storeImage'); // save info file Route::post('/api/file','FileController@store'); Route::put('/api/file/{file}','FileControll

nghquangy's avatar
nghquangy's avatar nghquangy8yrs agoLaravel
0
1
MARIN's avatar

Store input in multiple models

Hi, For a small project I would like to import an Excel file into a database. I have 3 models; group, user and group_user (group/user association). The form contains 2 input fields; name (which corresponds to the group name) and a file upload (rows with users). What is the best way to store the information and create the association? This approach will probably work, but it is

MARIN's avatar
MARIN's avatar MARIN9yrs agoTips
0
1
smanes's avatar

Ajax returned 302 redirect error

I know Ajax works fine with Laravel so I suspect this isn't an Ajax issue but something with routes. I'm building a vanilla file uploader. Here's the form: <form id="upload_form" method="POST" enctype="multipart/form-data"> {{ csrf_field() }} {{ method_field("POST") }} <div class="row">

smanes's avatar
smanes's avatar smanes9yrs agoLaravel
0
1
phpMick's avatar

Making Vue modal reusable.

Hi, I have created a Vue component for the edit and new function of a Datatable. (Inspired by this: https://adamwathan.me/2016/01/04/composing-reusable-modal-dialogs-with-vuejs/) What I would like to do now, is to make this reusable for my other Datatables. This means that it would need to have different fields on and slightly different functionality depending on the field typ

phpMick's avatar
phpMick's avatar Borisu9yrs agoVue
3
1
Last reply by Borisu 9yrs ago
derrickrozay's avatar

How to secure API endpoints for an app that doesn't have a login?

I'm not sure what to use to secure my API endpoints so not everybody can post or get data without authorization. The app will have no login and registration it will be used in-house. What should I use? JWT? How would I incorporate JWTs without login? The front end of the app is angular2. There are only two routes. One GET route that pulls data from the database, and one POST ro

derrickrozay's avatar
derrickrozay's avatar gustav11059yrs agoLaravel
7
3
Last reply by gustav1105 9yrs ago
Lars-Janssen's avatar

Question about props

Hi, I'm following the series on Laracasts about making a forum. Now I'm implementing file upload in vue.js 2.0 on my own. The problem I have right now is that I cannot change a prop. I'm trying to remove a media item on te parent component (reaction). In my Reactions.vue I loop over all reactions and show them: <div v-for="(reaction, index) in reactions" :key="

Lars-Janssen's avatar
Lars-Janssen's avatar jimmck9yrs agoVue
4
1
Last reply by jimmck 9yrs ago
mdhama's avatar

'fopen failed to open stream: Is a directory ' after deploy using Envoyer

I'm using File Storage laravel facade to upload file provided by user. Its working perfect in development environment but after deploy using Envoyer the following error is occurred. ErrorException in FilesystemAdapter.php line 119: fopen(/var/www/beta/beta.example.org/releases/20170515142152/public): failed to open stream: Is a directory in FilesystemAdapter.php line 119 at Han

mdhama's avatar
mdhama's avatar lapsonwor8yrs agoLaravel
1
1
Last reply by lapsonwor 8yrs ago
stefanantic7's avatar

Homestead 413 Request Entity Too Large

I want to upload file on my Homestead server and I can upload only files under 100 MB. Is there a way to upload a bigger file. I tried some solution but it still does not work. I tried to add: client_max_body_size 200M; into nginx.conf on Homestead And memory_limit = 512M, upload_max_filesize = 200M, post_max_size = 200M into php.ini on Homestead Also, i run sudo nginx -s relo

stefanantic7's avatar
stefanantic7's avatar stefananti...9yrs agoLaravel
0
1
boneill81's avatar

Uploading images via browser form or JSON request

Hi Guys, In an app which I have been working on for some time and which I am now getting close to completion, I can create a record either via a form or via json as per normal in Laravel. One thing though, while Laravel takes both requests perfectly it does not seem to do so when images are brought into the equation. I have a validation rule in my FormRequest as follows: 'recor

boneill81's avatar
boneill81's avatar boneill819yrs agoLaravel
0
1
pdoak's avatar

FileNotFoundException in Filesystem.php line 36:

I have been using the same code for a couple of years but today I have run into a problem. When I try and upload a pdf, I get the error: FileNotFoundException in Filesystem.php line 36: public function store(CreateFilesRequest $request) { $files = Request::file('filefield'); $file_count = count($files); $uploadcount = 0; foreach ($files as $file) { // $u

pdoak's avatar
pdoak's avatar pdoak9yrs agoLaravel
6
1
Last reply by pdoak 9yrs ago
futuremandigital's avatar

axios.post vs Spark.post

I have a form that I'm using to enter data for the project and upload an image for it. I am having difficulties getting Validator to validate the file from input by using Spark.post. I have seen that Spark uses axios.post with new FormData when updating profile photos but for an existing user. The issue is that when I use FormData, fill it in with input file value alongside oth

futuremandigital's avatar
futuremandigital's avatar futuremand...9yrs agoSpark
0
1
insight's avatar

How to install the localhost laravel implementation on shared Godaddy ?

Dear Friends, I am created a Laravel 5.3 web site on localhost , which work in path : http://localhost:8000/ I have a shared Godaddy service without ssh, but have file upload access. I uploaded all files to server but shows 404. What I need to do after fille upload on same path ? Please advise Thanks Anes P A

insight's avatar
insight's avatar jlrdw9yrs agoLaravel
8
2
Last reply by jlrdw 9yrs ago
robee00's avatar

Public folder not serving files

Hi! I tried making file upload working in Lumen, but I have some problems with the public storage. I set up filesystems (local and public), and created a symlink in public/storage which points to storage/app/public. If I created a file in storage/app/public then I cannot get it from http://mydomain.com/a.txt, assets/a.txt or storage/a.txt or anything. It looks like the url got

robee00's avatar
robee00's avatar robee009yrs agoLumen
0
1
AndrewBen's avatar

Am unable to send post request from my controller

I noticed it when trying to send a simple file upload request here is the URL am always referred to. http://localhost:8000/testupload?_token=L3SCsmmOzSq2TL7Cb7fH7UAUvbXUFY00JBJASmF2 I decided to send a simple dd request with just a token and i got the same result Whoops, looks like something went wrong. 1/1 MethodNotAllowedHttpException in RouteCollection.php line 218: in Rou

AndrewBen's avatar
AndrewBen's avatar AndrewBen9yrs agoLaravel
0
1
amitshrestha221's avatar

Response from dropzone

I am using dropzone plugin for image and file upload.. how do I show validation errors and success message? the code is working, all i need is messages from dropzone upload.. my view: <form action="{{ route('completeprofile.seekersubmit2') }}" method="post" class="dropzone tesst" enctype="multipart/form-data"></form> my cont

amitshrestha221's avatar
amitshrestha221's avatar tomi9yrs agoLaravel
1
1
Last reply by tomi 9yrs ago
Hujjat's avatar

How to show uploaded images from storage dictory

Hi, I have just watched the video of uploading file with laravel 5.3. Everything is working fine and I can upload file to storange/avatars directory. How can I show those files in views? I mean, previously we used to use asset() function which was searching in public directory, How can we show the files from storage/avatars directory? Thank's

Hujjat's avatar
Hujjat's avatar Hujjat9yrs agoLaravel
7
1
Last reply by Hujjat 9yrs ago
techn0guy's avatar

Array validation does not work if they are files

Hello, Here is my scenario: There is an array of file upload fields that are POST'd via the array 'color'. When there is no validation in place and I dump the request, the array is present: "color" => array:2 [▼ 1 => UploadedFile {#242 ▶} 2 => UploadedFile {#259 ▶} ] ] However, if I try and make the array required as seen here: 'size' => ['req

techn0guy's avatar
techn0guy's avatar themsaid9yrs agoLaravel
21
10
Last reply by themsaid 9yrs ago
mbpp's avatar

DropzoneJs issues on images title

Hello, im implemeting dropzone in my app, but i need to insert a title, the upload works fine, but after reading about appending dynamic data to each image, i saw in dropzone tips saying: "If you want to add additional data to the file upload that has to be specific for each file, you can register for the sending event:" So i imeplemetend, but in my case is not giving

mbpp's avatar
mbpp's avatar mbpp9yrs agoGeneral
0
1
fbrip's avatar

laravel 5.3 md5_file... failed to open stream: Permission denied

Hello I'm using Laravel 5.3 on Xampp (dev mode) and AWS (production mode) and I have a problem with pdf File upload . My post and edit function are working for some pdf uploads but not all of them ! For pdf I created and uploaded (under 2Mo), the upload is working but for the others I have an error page with this info : ErrorException in FileHelpers.php line 49: md5_file(C:\xam

fbrip's avatar
fbrip's avatar nolros9yrs agoLaravel
2
1
Last reply by nolros 9yrs ago
afujita's avatar

Laravel Excel: save filename into database

Hi. Using maatwebsite plugin to import csv file data into database. It is a stupid question, but how can I save also the filename? Here is what I am using: $file = Input::file('csv_file'); Excel::filter('chunk') ->load($file->getRealPath()) ->chunk(250, function($results) { foreach($results as $row) {

afujita's avatar
afujita's avatar afujita9yrs agoLaravel
7
1
Last reply by afujita 9yrs ago
christopher's avatar

Set Password on Uploaded Files

I currently building a little File Upload Script. Now i want to give the User the option to protect his files with a Password. My thought was, to take the uploaded file, zip it, and give the .zip file a password. I took a look at the ZIP Storage Provider from thephpleague. But i didnt found an Option to zip files? Otherwise there is a cool Package available which comes with thi

christopher's avatar
christopher's avatar christophe...9yrs agoLaravel
3
1
Last reply by christopher 9yrs ago
arslan2037's avatar

I want to save Image name in db

I want to save image file name in db here is the function for upload image //file upload public function imgUploader($FileToUpload) { //define main image path $destinationPath = public_path(). '/uploads/img/'; //define thumbnail path $thumbs = public_path(). '/uploads/img/'; // $gallery = public_path(). '/uploads/items/gallery/'; //get image

arslan2037's avatar
arslan2037's avatar arslan20379yrs agoLaravel
12
1
Last reply by arslan2037 9yrs ago
osherdo's avatar

Getting data from js to laravel (dropzone.js)

I have working image upload feature using 'dropzone.js` . What I need now is to associate the uploaded image to the authenticated user who uploads it, and store it in his personal folder of profile images. By that, I have created models of 'User' and ProfileImage. I don't know how to catch the file upload from dropzone.js to Laravel, and how to proccess it then. This is what I

osherdo's avatar
osherdo's avatar osherdo9yrs agoCode Review
3
1
Last reply by osherdo 9yrs ago
fatenfalfoul's avatar

Sximo laravel cms

Hello I'm editing a project using sximo and I have a master table that require a sub form containig file upload. I c'an't change the code to neclect the crush of data from database in any edit and how can I add an item that does not contain any information. Because if I choose new item it add me another row but containing the first line values and the default values are null

fatenfalfoul's avatar
fatenfalfoul's avatar fatenfalfo...9yrs agoLaravel
1
1
Last reply by fatenfalfoul 9yrs ago
YanTao's avatar

move uploade files from tmp to server

people upload file i store the tmp path to my cart , after people payment i move the tmp from serve , but how can i do it?

YanTao's avatar
YanTao's avatar YanTao9yrs agoLaravel
0
1
david001's avatar

Data not saved and image not uploaded

My data(title and images name) are not saved in database and images not uploaded to public directory.I got data saved message but my data is not saved in database . i have a form with two fields title input field and browse image field .i have add more button ,from which javascript generates again two more fields each time user click that button. public function postUpload(Req

david001's avatar
david001's avatar david0019yrs agoCode Review
8
1
Last reply by david001 9yrs ago
ashleywnj's avatar

Assign a value .val(field) and save without touching the field

I have a simple form in which the value of one field needs to be populated with a generated ID returned following a file upload. I am using the uploadcare widget All the values will save to the DB correctly providing I click or tab into the field following assigning the value. The field and widget: <div class="col-md-4"> <label class="control-la

ashleywnj's avatar
ashleywnj's avatar ashleywnj10yrs agoVue
1
1
Last reply by ashleywnj 10yrs ago
badQuetions's avatar

vueJs & dropzoneJs

hy help me please.. I'm Using DropzoneJs & vueJs, I want upload file in vueJs using dropzone.js but doesnt work, I have try like this & msg error "uploadImageGallery.options.autoProcessQueue = true is not a function uploadImageGallery.processQueue is not a function" how I can resolved this..? function uploadImageGallery() { Dropzone.autoDiscover = false;

badQuetions's avatar
badQuetions's avatar Sithu10yrs agoVue
1
1
Last reply by Sithu 10yrs ago
johnny's avatar

Integrated - Attach multiple files

I'm working on a form, where you have the option to upload multiple files. This is how it look like in the view file: <form action="{{ route('admin.media.store') }}" enctype="multipart/form-data" accept-charset="UTF-8" method="post"> {{ csrf_field() }} <input type="file" name="files[]" id=

johnny's avatar
johnny's avatar johnny10yrs agoTesting
0
1
psaunders's avatar

PHPunit not handling cache flush

I have an issue with an intermittent fault in my unit tests, it's kind of annoying because it only started happening recently on some tests I wrote a while ago, the system seems to be having an issue with file upload tests suddenly. /** @test **/ public function update_article_when_only_sections_change(){ $this->clearDatabase(); $section1 = factory(App\Secti

psaunders's avatar
psaunders's avatar psaunders10yrs agoTesting
0
1
eddy1992's avatar

How to fire a mail ?

Hi I want to fire a mail in this foreach and I am not sure how will I use this class to fire a mail. Now I have this class and it looks like this <?php namespace App\Acme\Email; use Illuminate\Support\Facades\Mail; use App\Acme\Email\Contracts\EmailTransactions as EmailTransactionsContract; /** * Flow Chart * * * we need : * customer email * customer name * view

eddy1992's avatar
eddy1992's avatar eddy199210yrs agoLaravel
0
1
ElpsySec's avatar

Excel Forms and OOP

I have a controller that accepts an excel upload file, stores the file (creates an entry in the documents table in the db with the path to file), and then extracts data from the excel file using PHPExcel and creates db entries from each from. This looks really messy. My question is how do you typically go about handing this sort of scripting in OOP where you have to stream in d

ElpsySec's avatar
ElpsySec's avatar Aferz2910yrs agoLaravel
1
1
Last reply by Aferz29 10yrs ago
trayan's avatar

Dropzone maxFileSize not working

Hello I implemented dropzone for my project as it is in "Build ProjectFlyer With Me" series. I have a form: <form action="{{ url("/hq/project/$project->id/bulk") }}" method="post" class="dropzone" id="addPhotosForm"> {{ csrf_field() }} </form> At the bottom of the file I include: <script src=&quo

trayan's avatar
trayan's avatar trayan10yrs agoLaravel
2
1
Last reply by trayan 10yrs ago
helin16's avatar

Help needed for Testing with vfsStream for fileupload to Restful API

Anyone did TDD testing with file upload before, i am having trouble to get this code working. on the test side public function createAssetSuccessfully() { //removing from database; $this->fake_asset_object->delete(); $this->assertCount(0, Asset::all()); $expected_file_name = 'test_some_test_file.txt'; $expected_type_id = sel

helin16's avatar
helin16's avatar ifpingram10yrs agoTesting
3
1
Last reply by ifpingram 10yrs ago
lipa's avatar

Getting names of uploaded files

I working on upload system. Uploading files works OK, but I have problem with getting name of uploaded file. I would like to store files on server with the same name as before upload. I'm using file upload jquery to keep it clean and simple. My code: public function upload() { $file = \Request::file('files'); $userId = \Request::get('userid');

lipa's avatar
lipa's avatar lipa10yrs agoRequests
1
1
Last reply by lipa 10yrs ago
sergiuwd's avatar

Call to a member function on null

Hello! I am learning Laravel following the tutorials. I have followed the steps, but I got this error: FatalErrorException in FlyersController.php line 87: Call to a member function move() on null The files: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Flyer; use App\Photo; use App\Http\Requests\FlyerRequest; use App\Http\Controllers\Control

sergiuwd's avatar
sergiuwd's avatar sergiuwd10yrs agoLaravel
0
1
sergiuwd's avatar

Function must be an instance of App\Http\Controllers\UploadedFile

Hello! I am trying to follow up the "ProjectFlyer" lesson, but I got stuck at an error. Whenever I try to upload a photo, I get this error inside /photos: Argument 1 passed to App\Http\Controllers\FlyersController::makePhoto() must be an instance of App\Http\Controllers\UploadedFile, instance of Symfony\Component\HttpFoundation\File\UploadedFile given, called in D:\xa

sergiuwd's avatar
sergiuwd's avatar sinosoft3yrs agoLaravel
2
1
Last reply by sinosoft 3yrs ago
Sithira's avatar

cURL error 77 on Windows 10 XAMPP

im trying to upload a text file to my S3 bucket. Every time i try i get this error RequestException in CurlFactory.php line 187: cURL error 77: error setting certificate verify locations: CAfile: ‪pathToMy.pem CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) i have my .ini set up like this curl.cainfo=‪"D:\LocalHost\php\ext\cacert.pem" And final

Sithira's avatar
Sithira's avatar Sithira10yrs agoLaravel
3
1
Last reply by Sithira 10yrs ago
anikkhan's avatar

Call to a member function getClientOriginalExtension() on a non-object

Hey I try to upload file but im getting this error "Call to a member function getClientOriginalExtension() on a non-object" public function add(){ $file = Request::file('file'); $extension = $file->getClientOriginalExtension(); Storage::disk('local')->put($file->getFilename().'.'.$extension, File::get($file)); $entry = new \Ap

anikkhan's avatar
anikkhan's avatar bashy10yrs agoLaravel
1
1
Last reply by bashy 10yrs ago
APPLE199's avatar

Change default error message of "kilobytes" to megabytes - Validation

I have a file upload class and if the user uploads file greater than "20" mb, it says "File must be less than 20000 kilobytes". How can I convert this to megabytes?

APPLE199's avatar
APPLE199's avatar APPLE19910yrs agoLaravel
0
1
kylevorster's avatar

Proper code writing with formatted error control

Hey, I know this is a very vague question but I hope someone might have the time to just look at this code and tell me what they think, could I do error controlling better or does it seem fine. <?php Route::post('/add', [ 'as' => 'SliderAdd', 'uses' => 'Admin\SliderController@store' ]); class StoreImageFileRequest extends Request { public function authori

kylevorster's avatar
kylevorster's avatar kylevorste...10yrs agoCode Review
1
1
Last reply by kylevorster 10yrs ago
thomthom's avatar

How to fix 413 Request Entity Too Large - n00b edition?

I just deployed a site on forge, and as I was testing a file upload form I ran into "413 Request Entity Too Large" error. Searching for it there appear to be some "nginx" configuration that needs to be set. However, my n00bness here appear to defeat me. I don't actually know how I do this on a forge server. From the forge control panel I found a Edit Files b

thomthom's avatar
thomthom's avatar thomthom10yrs agoForge
3
4
Last reply by thomthom 10yrs ago
ftiersch's avatar

"Caching" a fileupload before form validation

Hi guys (and gals), on my current project I stumbled across the following problem: I'm building an application that allows visitors to participate in a raffle. There are different types of raffles - one of them is a file upload (so user uploads his favorite vacation picture and has the chance to win something for example). I'm validating the form (there is just one form for all

ftiersch's avatar
ftiersch's avatar ftiersch10yrs agoRequests
3
1
Last reply by ftiersch 10yrs ago
khanvuthy's avatar

Duplicate imange name in laravel

hello everyone here, when i try to upload file in laravel 5.1 . i get one problem is filename is duplicate. how can i check does file i try to upload is already exist name ?

khanvuthy's avatar
khanvuthy's avatar lancebutle...10yrs agoLaravel
1
1
Last reply by lancebutler2 10yrs ago
jonathan.macgregor's avatar

A couple of queue questions

Hi everyone, I've started to work with Queue's in Laravel and have a couple of questions i'd like to ask in regard to how they work. The process i'm using is this: Step 1. Upload file Step 2. Process each row and add each row to a queue job. Step 3. Run queue job for that row after user confirmation. Step 4. Repeat steps 2 and 3 until done. My first question is that 'm trying t

jonathan.macgregor's avatar
jonathan.macgregor's avatar jonathan.m...10yrs agoLaravel
0
1
clkline's avatar

Project Flyer: $request->file('cover') returns null after refactor

I am working on the Project Flyer, the Bulk Uploads Episode. I got through most of it just fine. I have a few things renamed because I am not simply building exactly what he is building, but using his concepts to kick start my own project. That being said, the file upload worked fine until the section on refactoring. Now I am getting an error of: Argument 1 passed to App\StoryC

clkline's avatar
clkline's avatar clkline10yrs agoGeneral
6
1
Last reply by clkline 10yrs ago
deathmetalgore's avatar

Laravel Request $request->file() is always blank

I have a form that has a field to upload multiple files. So far so good. So when I select a few files and hit the submit button, the $request->file() is always empty no matter what. The name of my field is images_json. I suspected the route being PATCH or PUT could cause this (considering I'm uploading images on create and update), I made a separate POST route to handle the

deathmetalgore's avatar
deathmetalgore's avatar FarizF8yrs agoLaravel
13
1
Last reply by FarizF 8yrs ago
alexanderhempel's avatar

Count collection records slower than insert

Hello, I am using Laravel 5 and have a running mulitple file upload implementation via Dropzone. Now, i like to store a position number for a new file: $count = SplashImage::count(); $this->position = !$count ? 0 : $count; This gives me the correct position, when i upload a single file. But when i upload multiple files i get something like this: file 1: 0 f

alexanderhempel's avatar
alexanderhempel's avatar alexanderh...10yrs agoLaravel
13
1
Last reply by alexanderhempel 10yrs ago
Jawsh's avatar

Symfony / Laravel routinely rejecting audio files for being BIN files when they are verifiably not

The mimetype guesser is completely smashed when it comes to audio. It's pretty bad with some filetypes, but with nothing is it as bad as audio. It's not just that Google Music (where I get my songs) is doing wrong, because other people are having the same problems with music from all sorts of sources. Try uploading this file into Laravel and see how it processes it. http://jaw.

Jawsh's avatar
Jawsh's avatar oeb10yrs agoLaravel
1
1
Last reply by oeb 10yrs ago
iumesh's avatar

How to return response and continue executing script in laravel without queue

Hi am trying to develop a project in which we get a lot of data from android devices and i want to return response to device after file upload and then do processing, the processing takes time and the device number are huge hence i want to do it without queueing. So that i can process data quickly.

iumesh's avatar
iumesh's avatar jeban10yrs agoLaravel
7
1
Last reply by jeban 10yrs ago

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.