How to upload and run a script with laravel? - laravel-5

I want to write a php script (say A) which run an uploaded typescript (say B) which was uploaded with a CRUD (input file form).
I know how to upload files like images, and I guess that uploading a ts script which is a text file is not very different, but I have no idea how am I supposed to run this new script on a page...
Anyone can help ?

Related

Bes way to update the live Vue JS + Laravel Application

I am learning Vue JS 3. Now, I am developer a application using Laravel 9 with Vue js 3. Now, every time when I do some update I have to run this command:
npm run prod
And then have to make the entire project file as compressed zip file and then I upload the full compressed zip file to my server.
Note: I am updating every changes to by git repo .
So, my question is
whats the best way to upload the live laravel + vue js applicatoin?
If I only upload the app.js will it be work?
Thank You.

Laravel API temp image via url

I'm working on a Laravel API project, let see when you upload a image I change the colors, with a shell script. The api accepts urls so that means I have to save the image in a temp folder so that I can edit it and save it to my S3 filesystem. Is it convenient that I save the temp image in the S3 filesystems or local?
It will likely be much faster to save the image locally in a temp directory to make the changes before storing it on S3. You can use sys_get_temp_dir() to get a path used for temporary files.
https://secure.php.net/manual/en/function.sys-get-temp-dir.php

Remove "public/" from URL

The scenario
I have a script to upload a file to a directory and I need to return its path but without public/ prefix.
The upload destination is: public/uploads/, but I just need the uploads/ part.
The puzzle
I need public/ to upload the image because it is the physical directory which the image will be placed. So, how can I remove it (with a great approach) when I retrieve the path?
In practice
My final upload → /public/uploads/1.jpg
I want to retrieve → /uploads/1.jpg
Thoughts
I think I can remove the first part of the URL with the following snippet:
final_directory = directory.split('public/')[1]
But I don't feel comfortable by doing this.
Do you have anything better?
I think at the time of upload all files will be uploaded to the /public/uploads/ path.
When you fetch the file and show it, you can simply use the /uploads/ path. This is working for me.

Preventing file upload by submitting a form which has file tag

My client has millions of users driver website. I had to implement a custom file upload using AJAX/jQuery.
The file upload field is just needed to create a clickable and drop-downable file upload mechanism. Everything is working fine except when I submit the form it uploads the file again which has already been uploaded using ajax.
How can I prevent this uploading?
Move the file input to outside the form or replace the file input with a new one when you upload the file.

Force to upload 1 image with the same name in Codeigniter

I have made an image upload page. this all works smooth.
My problem is when i upload an image called filename.jpg and i upload it again the same image uploads but changes the name to filename1.jpg
how can i force this and make a message with something like 'the image you upload was allready uploaded'
thanks
the change in filename was initiated by the os of server computer
to produce the promt you have to check the file name for duplicates while you are uploading
using the php script
if you have a database which stores the filenames then it is very easy

Resources