Upload file on easyupload.io with curl linux - linux

I tried to upload file on file.io which has api using curl -F "file=#filename.txt" "https://file.io/"
how to achieve this using easyupload.io and validate that file is uploaded properly and also display the url for the uploaded file.

Easyupload.io uses Google Captcha in the background to prevent automatic uploading.
So I guess if there is no specific API for this site, it's not meant to be used with a script / program.
You can reverse engineer the upload process by opening the network tab in your browser's developer tools.

Related

Sending client file download link

I have a nodejs backend and I want to send a file download link to the client such that, the file is directly accessible by the client. The file types are JPEG and PNG. Currently, I am serving these files as data-uri but, due to a change in requirements, I must send a download link in response to the file request and, client can download the file later using that link.
Now the current workflow exposes a path /getAvatar. This path should send a response back to the client with the file link. The file, is stored in /assets/avatars relative to the server root. I know I can express.static middleware to send back static resources. However, the methods I have seen so far, res.send() and res.download() both tries to send the file as attachment rather a link that can be used later to download.
Basically, the behavior is like a regular file sharing site where, once a file is clicked, a link to it is generated which, is used for downloading the file. How can I do this?

Script in server saving locally

I wrote a script that is using slack API to parse AWS S3 files looking for strings or samples. As this is in testing, I'm using my local machine and ngrok to forward localhost traffic.
The thing is that the generated files are getting stores in my machine and will be stored in server once the script is ready for production.
Ideally, I'd like to avoid users needing to grab files from server. Do you think it's possible to store directly in user local machine?
No. Slack does not allow you to access the local machine of their users through a Slack app / API.
Solution 1: Download via browser
The easiest solution would be to offer a direct download link in a Slack message, e.g. via a Link button. Once the user clicks it he is prompted to download the file to his local machine.
Here is an example from one of my apps:
And once you click it you get this window:
To enable downloading via browser you need to set appropriate headers and send the file contents to the browser.
One approach is to have a helper script for the actual download and include a link to the helper script in the link button (you may also want to include some parameters in the link that defines what which file is downloaded).
The helper script then does the following:
Fetch the file to be downloaded (e.g. an PNG image)
Set headers to enable downloading via browser
Send the file to the browser
Here is an example in PHP:
<?php
$filename = "demo.png";
$file = file_get_contents($filename);
header('Content-Disposition: attachment;filename=' . $filename);
header('Content-Type: image/png');
echo $file;
die();
For more infos on download headers see also this answer on SO.
Solution 2: Upload to Slack
Alternatively you could upload the file to the user's Slack workspace via file.upload API method. That way the user does not need to download anything and and you can remove the file from your server after your app has finished processing.

Angular 5 Download file from dropbox and Upload it to AWS s3

I am currently using dropbox file picker to download the file. I got the download link after selection of file using dropbox picker.
Is there any possibility that we can save it inside bytestream in browser and upload it to server(Node.JS) using http post call ?
Or Is there any alternative to this scenario ?
Any help would be appreciated.
Instead of downloading and reuploading the file on the browser, I would have this step to be processed on the server side.
You can use Dropbox and S3 sdk's and follow the steps below:
Make a call to the server that will send IDs of the list of files available in Dropbox.
Let the user select a file in the angular app and send the selected file's resource identifier back to the server.
Download the file and then re-upload it to the S3 on the server side.
Display the result/status back to the user.
Is there any reason you want this to be done in the frontend?

What are the possible ways to transfer a file of more than 100MB generated via shell script, to any URL or server?

I have a shell script written, which generates an excel file of more than 100MB. Now, I want to transfer the file or say upload the file to one URL which is online storage server. This server will generate a URL containing the file after uploading.
The question is if we are able to upload the file using "cURL" to any given URL, then how to get the generated URL from that web page??
The URL generated after uploading the file is dynamic. (Dropbox kind of storage)
If it is not possible to get that URL then how to transfer such a big file.
Note: It is kind of automation, so please answer keeping automation in mind.
Thank you in advance.

Images stopped showing using Smart Lencioni Image Resizer

I don't know what I did, but for some reason images stopped working. Some browsers show the image, but the majority don't. I'm using v1.4.1 of Lencioni Image Resizer
This image will not show:
http://www.norwegianfashion.no/wp-content/themes/norwegianfashion/image.php?width=280&height=&cropratio=2:1&image=http://www.norwegianfashion.no/wp-content/uploads/magazine/issue5/siri1_72dpi.jpg
But you can access the image here:
http://www.norwegianfashion.no/wp-content/uploads/magazine/issue5/siri1_72dpi.jpg
If I change & with &, I get the message Error: no image was specified.
http://www.norwegianfashion.no/wp-content/themes/norwegianfashion/image.php?width=280&height=&cropratio=2:1&image=http://www.norwegianfashion.no/wp-content/uploads/magazine/issue5/siri1_72dpi.jpg
Another place I'm using it, is here, and that works fine:
http://www.advicis.no/wp-content/themes/business1/image.php?width=150&height=&cropratio=1:1&image=http://www.advicis.no/wp-content/uploads/OD-puzzle-large.jpg
What could cause this?
Apparently your PHP script cannot access the url http://www.norwegianfashion.no/wp-content/uploads/magazine/issue5/siri1_72dpi.jpg.
I can, and you can, but the server on which the PHP script is running can't.
Perhaps the PHP server doesn't have the right pluging installed to do HTTP requests, or the HTTP server blocks requests coming from within.
Can you insert some debugging into image.php showing the results of each step? Or post the part of the image.php code where it retrieves the image?
Can you login to the PHP server with SSH and see if you can execute:
wget http://www.norwegianfashion.no/wp-content/uploads/magazine/issue5/siri1_72dpi.jpg
Another solution is to let image.php grab the file from the local disk instead of through a HTTP request, but that requires some redesign of that script.

Resources