Browse Forum Podcast
All ThreadsLeaderboard
  1. Discussions

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

DoeJohn's avatar

Unable to JSON encode payload. Error code: 5

I'm working on Laravel (v5.7) app that converts uploaded CSV (with contacts) into array that is then passed as argument when job class is being dispatched. Here is the example of CSV file (format that is supported): 123456,Richard,Smith 654321,John,Doe Uploaded (CSV) file is handled like this: $file_path = $request->file_name->store('contacts'); $file = storage_path('app

DoeJohn's avatar
DoeJohn's avatar Jaytee6yrs agoLaravel
1
1
Last reply by Jaytee 6yrs ago
Mego's avatar

public/js and css folder sudennly disappeared

I have developed a small system on my localhost, using WAMP. Everything went OK. Then I manually uploaded the file from my wamp/www/project to FTP - live server. When I try to run an application, the CSS and JS files are not available. I have looked into the ftp and find, that there are no css and js folder in public/... why? Also the next mystery is, on my localhost those fold

Mego's avatar
Mego's avatar Ashley_Mok1yr agoLaravel
15
1
Last reply by Ashley_Mok 1yr ago
LadyDeathKZN's avatar

User group_id Team to have bulk mail system

Hi, I have my users with group_id and group with just a title (team, as example). I want to setup a bulk mail system, where the user with group_id that corresponds with team to recieve the emails. I have setup the relationships in the models as I am using the group_id in a form. I have something as such: foreach($user->group->id === 'team') { Mail::send('upload.emai

LadyDeathKZN's avatar
LadyDeathKZN's avatar LadyDeathK...6yrs agoLaravel
2
1
Last reply by LadyDeathKZN 6yrs ago
elo's avatar

Image URL works in local serve but fails in staging environment

Hi guys, I am working on an API application using Laravel 5.8 version. When a get request is made to the products api endpoint, I return a ProductResource collection which looks like this public function toArray($request) { return [ 'id' => $this->id, 'name' => $this->name, 'category' => $this->category,

elo's avatar
elo's avatar elo6yrs agoLaravel
5
1
Last reply by elo 6yrs ago
ALOKUR's avatar

Laravel excel validate two columns' combination is not duplicate

I have a requirement wherein I need to ensure that Excel file being uploaded by user does not have duplicate rows w.r.t. 2 particular columns. Example: In the table below, I want to flag out that row 1 and 2 contain duplicate combination of COMPANY_CODE and CLERK_CODE: COMPANY_CODE CLERK_CODE CLERK_NAME 123 A Johny 1

ALOKUR's avatar
ALOKUR's avatar ALOKUR6yrs agoCode Review
0
1
fredemagi's avatar

Compiled css not reflecting changes after deploy

I have made some changes locally to a css file which works locally. However, when I deploy to Laravel forge, the css file gets uploaded, but the compiled css file (combined of all) does not contain the change. What could be wrong?

fredemagi's avatar
fredemagi's avatar Tray26yrs agoForge
4
1
Last reply by Tray2 6yrs ago
jgravois's avatar

Upload to DigitalOcean Spaces - Strange Destination

I am uploading a file to DO Spaces using this code with the data-points of (id: 650, doc: 'shop_report') public function doc_upload(Request $request) { $file = $request->file('file'); $id = $request->id; $doc = $request->doc; $ext = $file->getClientOriginalExtension(); $fileName = $doc . '.' . $ext; $upload_succes

jgravois's avatar
jgravois's avatar jgravois7yrs agoCode Review
3
1
Last reply by jgravois 7yrs ago
shifoodew's avatar

Intervention\Image\Exception\NotReadableException

Hi I want to upload an image but I encounter this error Error Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files Request product_desc: "Sample 111" product_image: "adviser.jpg" product_name: "Sample 1" product_price: "10" product_stock: "12" product_tag: "Sample 111" This is my contro

shifoodew's avatar
shifoodew's avatar shifoodew7yrs agoLaravel
0
1
christopher's avatar

Code Review / Refactor for .csv import

I am importing a .csv file and map the .csv columns to a specific database column. You can change the array key to change the mapping for the database. This is my current code: /* * Get the uploaded .csv file */ $inputFileName = __DIR__ . '/data.csv'; /* * Create an instance of the .csv Reader and load the * uploaded

christopher's avatar
christopher's avatar lostdreame...7yrs agoGeneral
1
1
Last reply by lostdreamer_nl 7yrs ago
Prathamesh6921's avatar

Unable to store files in the databse

Not getting any error while uploading the file in the database I am trying to store multiple files in the database in laravel but not getting any error, I also check with the dd in the backend but got nothing. I don't know how check. Can anyone help me how how to fix this? The path in which I'm storing the diploma files is used to store another files so I am using same folder(s

Prathamesh6921's avatar
Prathamesh6921's avatar D97059967yrs agoLaravel
1
1
Last reply by D9705996 7yrs ago
Mahaveer's avatar

How to validate array fileds.

Dear All member How to validate input type file array fileds. And also add maximum file size uploads validation.

Mahaveer's avatar
Mahaveer's avatar Mahaveer7yrs agoLaravel
2
1
Last reply by Mahaveer 7yrs ago
martinszeltins's avatar

I'm seeing Chinese letters after converting UTF-16 to UTF-8

I have a UTF-16 encoded .CSV file. The field delimiter is a comma (,) and string delimiter is double quotes ("). Changing the encoding outside of PHP is not an option. I need to turn it into an associative array with PHP. But I can't seem to get it to recognize that UTF-16 encoding. Here is my file contents for numbers.csv: "Phone number" "+1 55500718"

martinszeltins's avatar
martinszeltins's avatar ethor3yrs agoLaravel
3
1
Last reply by ethor 3yrs ago
Gabotronix's avatar

dispatch action with formData to proccess into the store?

Hi everyone, I'm making an admin panel for my web, for state management I'm using this library: https://francescosaveriozuppichini.github.io/Flue/index.html It's similar to vuex but with much less bolierplate andoverhead, it also lets me use javascript classes to keep everything object oriented and also reactive! Now one of my inputs is for uploading a file via axios but I was

Gabotronix's avatar
Gabotronix's avatar Gabotronix7yrs agoGeneral
0
1
aondoe's avatar

Files don't upload to the

Hello. I'm trying to upload files into the public folder. I've already created a link to the storage folder using artisan. But for some reason, the file title uploads to the MySQL field. Has anyone else experienced this? The main code is in the if-statement near the bottom of the code. Here is my Controller public function store(Request $request){ request(

aondoe's avatar
aondoe's avatar aondoe7yrs agoLaravel
2
1
Last reply by aondoe 7yrs ago
MartinFolkerts's avatar

Testing upload_max_filesize

Hi, I've got an app with a laravel backend where i like to upload some images and video using my Larvel api/backend. I would like to add a test that hits the boundries of my system eka, the ini_get('upload_max_filesize') To this extend I added a test like: /** * @test */ public function it_should_throw_an_error_when_uploading_an_image_that_is_too_big() { $path = base

MartinFolkerts's avatar
MartinFolkerts's avatar MartinFolk...7yrs agoTesting
2
3
Last reply by MartinFolkerts 7yrs ago
IrfanU's avatar

Handling Large Files Upload With Laravel

Hello, How would you guys approach uploading large files (up to several Gbs) in Laravel. Also what would be the best way notify the user automatically when his/her file is uploaded successfully.

IrfanU's avatar
IrfanU's avatar NickVahali...7yrs agoLaravel
3
1
Last reply by NickVahalik 7yrs ago
Satya's avatar

Laravel

Uploading large file in laravel

Satya's avatar
Satya's avatar pardeepkum...8yrs agoLaravel
8
1
Last reply by pardeepkumar 8yrs ago
tubbrez's avatar

new changes not being detected

Hi Guys! I got a very weird bug. I made a small change in my laravel model file and uploaded it on the server but it is not being executed. it's like it is still executing the file but without my changes. Earlier everything was fine but now suddenly its only that one specific model that is giving me this bug. Even if i delete the file from server, it is still being executed. If

tubbrez's avatar
tubbrez's avatar tubbrez8yrs agoLaravel
2
1
Last reply by tubbrez 8yrs ago
kaiserkais's avatar

Trying to get property of non-object

i try to call an image from database and i get this this is what i have in user model public function photo() { return $this->belongsTo('App\Photo'); } and photo class protected $fillable = ['file']; protected $uploads = '/images/'; // function with laravel public function getFileAttribute($photo) { return $this->uploads . $photo; } when icall wth this p

kaiserkais's avatar
kaiserkais's avatar kaiserkais8yrs agoEloquent
2
1
Last reply by kaiserkais 8yrs ago
mstdmstd's avatar

The code is NOT highlighted with parameters in component

Hello, In my laravel5.5/vuejs2.5 application I want to highlight some files and I have highlight.js installed with next in my package.json: "dependencies": { "highlight.js": "^9.12.0", In my resources/assets/js/app.js I define route: import SourceViewer from './components/lib/SourceViewer.vue'; ... const routes = [ { path: '/',

mstdmstd's avatar
mstdmstd's avatar mstdmstd8yrs agoCode Review
0
1
staticcode's avatar

Upload large files

Hi guys, is there a laravel way (no other packages) to upload large files? when I do: Storage::disk('local')->put('file.xml', $request->file); or something like that, I always end up with and error: Illuminate \ Http \ Exceptions \ PostTooLargeException I set the ini file to allow files over 2gb but even when uploading a file of 24mb I get this error. Hope someone can hel

staticcode's avatar
staticcode's avatar staticcode8yrs agoLaravel
5
1
Last reply by staticcode 8yrs ago
Webiondev123's avatar

Unable to upload image in RegisterController.php

public function uploadfile(){ $rules = array( 'file' => 'required | mimes:jpeg,jpg,png | max:1000', ); $request=new Request(); $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return Redirect::back() ->withErrors($validator)

Webiondev123's avatar
Webiondev123's avatar cookie_goo...6yrs agoLaravel
7
1
Last reply by cookie_good 6yrs ago
tanmay_das's avatar

Laravel shared hosting deployment

I have a copy of my project in my office pc and I pushed the project to a bitbucket git repo. I have been instructed to deploy the project as soon as I go home. I came to home and: Cloned the repo to home pc. It didn't have the vendor directory as it is ignored by the gitignore file A quick google search suggested me to run composer install, but it didn't work because of u

tanmay_das's avatar
tanmay_das's avatar bobbybouwm...8yrs agoGuides
3
1
Last reply by bobbybouwmann 8yrs ago
bipin's avatar

not reading docx mimes

hello guys i m using mimes to do file validation here is my code $validator = Validator::make($input, [ 'resume' => 'nullable|mimes:docx,doc|max:2000', ]); when user uploading docx file type its throw error ,it read some docx type and some not

bipin's avatar
bipin's avatar bipin8yrs agoLaravel
2
1
Last reply by bipin 8yrs ago
HmorV's avatar

Problem with two private disks filesystem

Hi, I'm trying to use two private disks (one for uploading attachments to the storage/app/attachments folder and the other for uploading avatar users in storage/app/avatars folder). This is my config: 'disks' => [ 'attachments' => [ 'driver' => 'local', 'root' => storage_path('app/attachments'), 'visibility' => 'private' ], '

HmorV's avatar
HmorV's avatar HmorV8yrs agoLaravel
0
1
Rainieren's avatar

Laravel - POST 422 (Unprocessable Entity)

Hello, I have a small problem, I followed Jeffrey's tutorial on how to ajaxify the image upload system for a users profile, but I have an error on uploading a file. It for some reason says. POST http://ict-hulp.dev/gebruikers/Rainieren/avatar 422 (Unprocessable Entity) I don't know where this problem occurs but if I comment out this line of code in my avatarForm.vue: axios.post

Rainieren's avatar
Rainieren's avatar Rainieren8yrs agoLaravel
8
1
Last reply by Rainieren 8yrs ago
NotAGoodCoder's avatar

Processing chunked uploads help please

So I'm accepting user-uploaded videos for a new internal service that I'm creating. Due to the size of most videos, I am using Dropzone.js and the chunked upload functionality that it implements. Right now, my store method receives the uploaded 20MB chunk, stores it in storage/app/processing with a semi-sanitized filename, and keeps doing that for all chunks that are sent. On t

NotAGoodCoder's avatar
NotAGoodCoder's avatar kfirba8yrs agoCode Review
6
2
Last reply by kfirba 8yrs ago
FSWebeloper's avatar

CKEditor and KCFinder in Laravel

Hi. I googled all the web, but each article is similar to another and couldn't help!!! I've a CKEDITOR and want to use KCFINDER for image uploading and file management. ckeditor path: public/assets/js/ckeditor kcfinder path: public/assets/js/ckeditor/kcfinder in ckeditor config.js I added these: config.filebrowserBrowseUrl = 'public/assets/js/ckeditor/kcfinder/browse.php?opener

FSWebeloper's avatar
FSWebeloper's avatar FSWebelope...8yrs agoLaravel
0
1
shanely's avatar

storage symbolic link doesn't sync

Hi I am uploading my file image to the storage/app/public/imageprofile my problem is that the symbolic link is not syncing everytime I upload Image I already set php artisan storage:link for the first time. I am in windows 10 Thank you in advance.

shanely's avatar
shanely's avatar shanely8yrs agoLaravel
0
1
DoppyWoppy's avatar

Call to a member function keys() on null

I am trying to get count of header from an uploaded CSV file. But I am getting error "Call to a member function keys() on null". Here is my code. public static function import(request $request) { $error = []; if($request->hasFile('file')) { $path = $request->file->getRealPath(); $data = Excel::load($path)->first()->keys()->toArray();

DoppyWoppy's avatar
DoppyWoppy's avatar DoppyWoppy8yrs agoLaravel
2
1
Last reply by DoppyWoppy 8yrs ago
PixelPaul's avatar

load in page content and new JS functions for each new page/link and remove old.

So i am trying to build an app that when the use clicks on a menu item istead of just loading the new page it will just get the inner contents of the new page and swap out the current contents with the new contents. The problem i have found is that the old javascript functions from the old content is still active in memory. So, if i had some hook functions or timer functions or

PixelPaul's avatar
PixelPaul's avatar PixelPaul8yrs agoJavaScript
11
1
Last reply by PixelPaul 8yrs ago
sureshp's avatar

PDF Viewing

How to view a pdf file after uploading, without removing images in pdf pages?

sureshp's avatar
sureshp's avatar martinbean9yrs agoLaravel
1
1
Last reply by martinbean 9yrs ago
alhoqbani's avatar

Changing default disk for testing.

I'm trying to build a test for images handling in my application. For the database testing I'm using DatabaseMigrations, so the test persists records in sqlite memory and then discard them after the test. Is there a way to achieve equivalent results when testing file handling (uploading and deleting files). Right now I'm using the fake method as suggested per the docs:

alhoqbani's avatar
alhoqbani's avatar marcusmyer...6yrs agoTesting
4
3
Last reply by marcusmyers 6yrs ago
anmol's avatar

server error

i have followed the entire process from uploading root file in home folder and public file in public _html also i have dumped the entire databse.which was successfully done.now when the refreshed the website it is showing a server error 500.i am totally confused.what should i be doing???intially there was a static website to which i uploaded mine and chaned the path in index.ph

anmol's avatar
anmol's avatar anmol9yrs agoLaravel
5
1
Last reply by anmol 9yrs ago
haakym's avatar

Braintree setting amount and avoiding rounding errors

I am creating a web app using PHP/Laravel and Braintree for payments. I am using the Braintree dropin. A simplified flow of the web app: User uploads a file and selects a service from dropdown, submits form User is shown quote/price which is calculated by taking the uploaded file's word count * selected service User selects payment via Braintree drop-in, submits form to pay We

haakym's avatar
haakym's avatar haakym9yrs agoGeneral
0
1
User's avatar

Laravel: Pages not loading properly

This might look useless question, but I'm unable to understand the problem here. The problems are: When I load the page, first this loads: a page containing "Upload files here" form And then, after uploading the file: this page loads: another "Upload files here" form yield('content') is not working. Although @include is working fine. I made master.blad

User's avatar
User's avatar User9yrs agoLaravel
4
1
Last reply by User 9yrs ago
melcap's avatar

Logged out after too many quick requests

Hi, I am using Resumable.js to upload very large files to my Laravel App (e.g. 500 Gig files). To do so, Resumable.js slices the file and uploads chunks of 10Mb at a time. This works well from a network / load perspective. The problem is, after a serie of quick ajax requests from the same page, I get logged out (maybe 25 requests within a few seconds). I have turned off CSRF bu

melcap's avatar
melcap's avatar melcap9yrs agoLaravel
0
1
colehendricks@live.com's avatar

How To Grab User ID From Auth New User Object

I have a situation where I am using the auth methods that come with Laravel and I need to grab the User ID of the newly created user. I need the user ID because I want to set their uploaded avatar file name to be the user id so when it gets updated it just overwrites the previous file. This will reduce clutter so that the user only ever has 1 avatar file associated with them.

colehendricks@live.com's avatar
colehendricks@live.com's avatar colehendri...9yrs agoLaravel
4
1
Last reply by [email protected] 9yrs ago
denny's avatar

Most efficient solution to delete through hasMany relationship in a way that fires "deleting" method on the collection?

In my app, I have Site and Archive models where each Site hasMany Archives. Each Archive, in addition to having a record in the DB, has a file that's uploaded to S3. When deleting an individual Archive, I have a job attached to the deleting event to process the file deletion in the background: class Archive extends Model { public static function boot() { paren

denny's avatar
denny's avatar denny9yrs agoEloquent
0
1
4ndro1d's avatar

Send files via email from register form

This is how I can send multiple files via email directly from a form without the need of uploading the file: $input = Input::all(); $data = ['level' => 'register', 'introLines' => ['Ein neuer Benutzer hat sich registriert und wartet auf die Freischaltung', 'Im Anhang befinden sich vom Benutzer übermittelte Dokumente.'], 'actionText' => 'Benutzer verwalten',

4ndro1d's avatar
4ndro1d's avatar 4ndro1d9yrs agoGeneral
9
1
Last reply by 4ndro1d 9yrs ago
Ninjutsu's avatar

Cant Update Records Related ID in Pivot :(

So once again I'm having issues with some Many to Many functions. I have 2 models in a Many to Many relationship, Plays and Conferences. I'm simply trying to allow a user to link a play to another conference by replacing the related conference id (in pivot table) with the id value they choose in the select box. With Eloquent. public function update(PlaysEditRequest $request, $

Ninjutsu's avatar
Ninjutsu's avatar Ninjutsu9yrs agoLaravel
1
1
Last reply by Ninjutsu 9yrs ago
squibby's avatar

How to upload/download files with s3?

Hi, Struggling a little bit with downloading files from amazon s3 using laravel Storage. Uploading a file is no problem: Storage::disk('s3')->put($destination , file_get_contents($request->file), 'public'); But then when I want to download a file i am having difficulty. $import = CsvImport::find($id); $file = Storage::disk('s3')->get('uploads/csv/' . $import->fi

squibby's avatar
squibby's avatar Shahrukh48yrs agoLaravel
2
2
Last reply by Shahrukh4 8yrs ago
melkhior's avatar

Validator rules question

Hi! Wanted to ask, I saw there's a validator rule for mime types, that you provide file extensions too, how does it work? Does it check just if the mime type matches? Or if the file extension is also matching the mime type of the file? I mean, for example I want to strictly allow only .doc files, and .png files, and a user uploads a file called 'file.doc', that has a mime type

melkhior's avatar
melkhior's avatar melkhior9yrs agoLaravel
2
1
Last reply by melkhior 9yrs ago
Xron's avatar

Issue using ->move()

I'm trying to move a file once it's uploaded but I'm having an issue, I've tried a number of things but for some reason when a file is uploaded it throws a 500 error with "page isn't working". This is what I have inside my control so far; protected $allowedFileExt = [ 'png', 'jpg', 'gif', ]; public function postImage (Request $reque

Xron's avatar
Xron's avatar Xron10yrs agoCode Review
0
1
namht1st's avatar

Upload and execute Excel Files

Hi, i'm developing an web application need to insert data to database from uploaded excel file. Can you guys suggest me how or use what plugin to do that :D Thanks in advance

namht1st's avatar
namht1st's avatar namht1st10yrs agoLaravel
2
1
Last reply by namht1st 10yrs ago
6ber6ou's avatar

FileNotFoundException in Filesystem.php...

Hi all. I uploaded a file and now I want to get the content of this file : use File; $content = File::get( $request->input( 'file' ) ); But I have this error : FileNotFoundException in Filesystem.php line 40: File does not exist at path

6ber6ou's avatar
6ber6ou's avatar kadari10yrs agoLaravel
2
1
Last reply by kadari 10yrs ago
RobertBaelde's avatar

Linebreaks dont work using a queue

I have a controller that generates an text file and uploads it to my dropbox. Everything worked fine. However i moved the file generating code to a job. So i could use a queue to manage the file generation. I used \n for the linebreaks. But this doesn't work when using the queue. I think it has something to do with that the php is executed by the cli. How can i get the line bre

RobertBaelde's avatar
RobertBaelde's avatar RobertBael...10yrs agoLaravel
3
1
Last reply by RobertBaelde 10yrs ago
Ahava's avatar

ProjectFlyer Photo upload issues

Hi, I've just followed the video "Bulk File Uploads" but I'm getting the following error when uploading a file. FatalErrorException in FlyersController.php line 44: Call to a member function addPhoto() on null in FlyersController.php line 44 My FlyersController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests\Flye

Ahava's avatar
Ahava's avatar Ahava10yrs agoLaravel
2
1
Last reply by Ahava 10yrs ago
freeride8's avatar

Image not found neither in public nor in storage directory

Well, the logic of the app is: a user uploads a file (image). The file goes in storage/uploads. But the image should be visible in the user's profile. So I tried: < img class="getImage" src="http://localhost/bluedrive/drive/storage/uploads/1/DSC_8816.jpg">; But it looks like there is not such file. I've also put the same file in public/uploads and addr

freeride8's avatar
freeride8's avatar freeride810yrs agoLaravel
10
1
Last reply by freeride8 10yrs ago
lara30453's avatar

Queuing image upload and manipulation

Hello everyone, My site allows users to upload images, for this i have created an image uploading model file that is accessed in the profile controller when a user updates their avatar. I want to add queuing with redis into this system. I just want some tips on how to do this and should I use redis as it isn't rally built for queuing. Also, just as a note I store my images in S

lara30453's avatar
lara30453's avatar lara3045310yrs agoTips
0
1

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.