← prev | next →
ErgashevXurshid 2019-03-29 15:27:13
Testuserid 2019-03-29 13:40:41
Hi gyz
I want to get uploaded image’s real path. I have tried getRealPath() but its not wprking…
Do you have any solution for that?
https://stackoverflow.com/questions/16386350/php-get-file-path-of-an-image
PHP get file path of an image? –
Stack OverflowExample:
The image url:
localhost/example/folder/filename.jpg
I want to get path of the image so it must be:
localhost/example/folder/
How to do that?
I speak English not well. Thanks!
I have
ErgashevXurshid 2019-03-29 15:31:16
PHP Begginer 2019-03-29 15:04:02
I am having some problem with implementing ACL ,Please find the errors on this link https://pastebin.com/mGVm6Py3
role_user table name is already exist
ErgashevXurshid 2019-03-29 15:33:24
If you have not necessary data, you can try php artisan migrate:refresh
ErgashevXurshid 2019-03-29 15:34:27
Or drop role_user table and migration
ErgashevXurshid 2019-03-29 15:35:02
Than php artisan migrate
praneet81 2019-03-29 16:21:47

This is my route for update as put request
praneet81 2019-03-29 16:22:03
praneet81 2019-03-29 16:22:31

I’m passing that as form action
praneet81 2019-03-29 16:22:48

This is the controller for now I’m just checking
praneet81 2019-03-29 16:23:00
Why am i getting this error?
praneet81 2019-03-29 16:23:23
When i remove the action from the form the error is gone
praneet81 2019-03-29 16:23:28
Why is it doing so?
ErgashevXurshid 2019-03-29 16:56:56
praneet81 2019-03-29 16:22:31
I’m passing that as form action
action='{{ [ BlogsController@update(), ‘id’ => $post->id ] }}’
PHP Begginer 2019-03-29 17:03:44
Why am i getting this error ?
PHP Begginer 2019-03-29 17:03:47
https://paste.laravel.io/f2b0efcd-c37a-435c-838b-f6a037966745
ErgashevXurshid 2019-03-29 17:06:31
PHP Begginer 2019-03-29 17:03:44
Why am i getting this error ?
because you don’t send $id to controller
PHP Begginer 2019-03-29 17:08:23
how? i am running php artisan migrate
praneet81 2019-03-29 17:19:12
Yes i realised i was missing the id
Emma250 2019-03-29 17:19:35
https://www.radderpoint.com/laravel-developer-available#.XJ4oqVKubx0.telegram
Laravel Developer Available
Leetump 2019-03-29 18:35:57
How I upload and retrieve video in LARAVEL
nikhil_ev 2019-03-29 18:36:45
Any laravel-angular login git project?
PHP Begginer 2019-03-29 19:14:25
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table role_user add constraint role_user_user_id_foreign foreign key (`u
ser_id`) references users (id) on delete cascade)
Testuserid 2019-03-29 19:15:40
PHP Begginer 2019-03-29 19:14:25
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table role_user add constraint role_user_user_id_foreign foreign key (`u
ser_id`) references users (id) on delete cascade)
Try to run yhis query in phpMyAdmin it will show accurate error
PHP Begginer 2019-03-29 19:16:32
i am trying to migtate into database
Testuserid 2019-03-29 19:17:14
ErgashevXurshid 2019-03-29 15:27:13
https://stackoverflow.com/questions/16386350/php-get-file-path-of-an-image
Thanks but noy working… I want to store full path(string) in data base image is uploading perfectly in destination folder
Testuserid 2019-03-29 19:18:48
PHP Begginer 2019-03-29 19:16:32
i am trying to migtate into database
Yes but if you fire the errored query in phpmysql it will show the perfect error and then change your migration file… this hack works for me all time
PHP Begginer 2019-03-29 19:19:18
i found the problem on my relationship .Can someone spot doing wrong .
PHP Begginer 2019-03-29 19:19:37
snippet of code is causing that
PHP Begginer 2019-03-29 19:19:39
Schema::table(‘role_user’, function (Blueprint $table) {
$table->foreign(‘role_id’)
->references(‘id’)
->on(‘roles’)
->onDelete(‘cascade’);
$table->foreign(‘user_id’)
->references(‘id’)
->on(‘users’)
->onDelete(‘cascade’);
});
PHP Begginer 2019-03-29 20:58:05
above problem has been resolved .The issue was bigIncrements
PHP Begginer 2019-03-29 20:58:35
Now I am facing another problem
PHP Begginer 2019-03-29 20:58:54
BadMethodCallException : Call to undefined method IlluminateDatabaseEloquentRelationsHasMany::attach()
ErgashevXurshid 2019-03-29 21:23:06
Testuserid 2019-03-29 19:17:14
Thanks but noy working… I want to store full path(string) in data base image is uploading perfectly in destination folder
Do you want to crop images?
ErgashevXurshid 2019-03-29 21:23:26
Or nope
ErgashevXurshid 2019-03-29 21:24:51
Do you know this method?
ErgashevXurshid 2019-03-29 21:24:53
https://laravel.com/docs/5.8/requests#retrieving-uploaded-files
Laravel – The PHP Framework For Web Artisans –
LaravelLaravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Testuserid 2019-03-30 07:33:24
ErgashevXurshid 2019-03-29 21:23:06
Do you want to crop images?
No simple upload
Testuserid 2019-03-30 07:56:30
ErgashevXurshid 2019-03-29 21:24:53
https://laravel.com/docs/5.8/requests#retrieving-uploaded-files
Its uploading successful but it stores the name of file in database but I want to to whole path from where user have uploaded the file as string
Harrisdtt 2019-03-30 08:08:49
hello everyone could you recommend me which laravel version should I use for production.
R_IT_Geek 2019-03-30 08:44:54
Why, when I send an AJAX request,
It goes back to the page with the link in the AJAX????
The operation is done correctly.
And I will return the values below.
return [‘success’=>’OK’];
What should I do?
loveycom 2019-03-30 08:54:39
Testuserid 2019-03-30 07:56:30
Its uploading successful but it stores the name of file in database but I want to to whole path from where user have uploaded the file as string
You need to (1)get the path to the image folder and (2) append the file name to it.
To do (1), use url() method or asset() method.
loveycom 2019-03-30 08:58:41
R_IT_Geek 2019-03-30 08:44:54
Why, when I send an AJAX request,
It goes back to the page with the link in the AJAX????
The operation is done correctly.
And I will return the values below.
return [‘success’=>’OK’];
What should I do?
Your question is not clear
Testuserid 2019-03-30 09:19:06
loveycom 2019-03-30 08:54:39
You need to (1)get the path to the image folder and (2) append the file name to it.
To do (1), use url() method or asset() method.
ok I’ll try that
thanks
R_IT_Geek 2019-03-30 09:34:43
loveycom 2019-03-30 08:58:41
Your question is not clear
This is ajax code.
var url_='{{route(‘getGift’,$gift->id)}}’;
$.ajax({
url: url_,
method: ‘GET’,
success: function (data, status) {
// debugger;
console.log(data);
},
error: function (result, status, err) {
swal(result.err, “”, “error”);
alert(‘result.err’);
}
});
and this is my controller
public function getGift($gift_id)
{
// operation
if ( condition){
return [‘success’ => ‘success’];
} else {
return [‘error’ => ‘error’];
}
and output!!!
👇🏻👇🏻
R_IT_Geek 2019-03-30 09:35:14
R_IT_Geek 2019-03-30 09:36:57
R_IT_Geek 2019-03-30 09:35:14
Why not go back to the same page?
loveycom 2019-03-30 10:03:40
1. Ajax do not redirect so something is causing it.
praneet81 2019-03-30 10:07:47
PHP Begginer 2019-03-29 19:14:25
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table role_user add constraint role_user_user_id_foreign foreign key (`u
ser_id`) references users (id) on delete cascade)
This is the new error on laravel 5.8 i fixed this by giving the foreign key a type of bigInteger and it worked
loveycom 2019-03-30 11:12:31
This error is not from Laravel, instead, it’s from Mariadb. This is similar to sql length error experienced on Mysql. Simple fix to the error above is to switch db (I have 3 dbs) or use the fix above.
R_IT_Geek 2019-03-30 11:26:52
loveycom 2019-03-30 10:03:40
1. Ajax do not redirect so something is causing it.
I changed the AJAX to the post, it was fine.
tnx
← prev | next →