I have a file stored in an s3 bucket. I can upload fine but when I try to download using the code below I get file not found exception thrown e.g.
Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
The file "https://s3.us-west-2.amazonaws.com/mybucket/puppy.jpg" does not exist
When I navigate to the same url in a browser, the file downloads fine.
This is my code:
return response()->download(Storage::disk('s3')->url($file->path), $file->name);
Any ideas what I'm doing wrong?
This seems to work unless anyone know a more efficient technique:
return response()->streamDownload(function () use ($file) {
echo file_get_contents(Storage::disk('s3')->url($file->path));
} , $file->name);
Related
Hello!
So, when i upload a file with nestjs and multer, i want to set the dest in the module to an url, but if i do that, then it gives me an error:
EINVAL: invalid argument, mkdir 'C:\Users\almak\Desktop\Chatenium2\chatenium-server\http:\localhost'
Can you help me why? Thanks, and also is there any way to prevent nestjs from renaming and removing the file extension from the file (test.png => 03ebe1f47494378fee61196c0524afaf )
Heres the code:
Module:
MulterModule.register({
dest: process.env.CDN_URL,
}),
Controller:
#Post("uploadImg")
#UseInterceptors(FileInterceptor("file"))
async uploadedFile(#UploadedFile() file) {
return file;
}
dest by default is a local directory for the server to access via the fs module. If you need to upload the file to another server from your server, you should use a different storage type.
As for the renaming of the file, that's also multer's default, you can pass options to the FileInterceptor according to multer's documentation to change how the file gets handled.
I have successfully been able to upload file when the filename is just one word, When there are spaces in the name, the file, I get error from server.
Example: 1.] '.../musics/Love.m4a' -> upload successfully
2] '.../musics/Love Thy Neighbor.m4a' -> upload failed
Any idea on how to handle this issue in React native will be highly appreciated.
I have been trying to upload an audio file in react-native but because of space in file name not being able to upload to server, I get below error from a server;
**file:** {uri: 'file:///Users/fathom-d004/Library/Developer/CoreSiā¦m.brandarmy.user1-Inbox/Love%20Thy%20Neighbor.m4a',
name: 'Love Thy Neighbor.m4a', type: 'audio/x-m4a'}
error: Error: ENOENT: no such file or directory, open '/Users/fathom-d004/Library/Developer/CoreSimulator/Devices/83619055-D45F-4FA9-85CC-A2009A599EA7/data/Containers/Data/Application/FE596B31-0385-4F77-B342-EF354F86FF1B/tmp/com.brandarmy.user1-Inbox/Love%2520Thy%2520Neighbor.m4a'
Used below simple solution;
I believe I've found the error. The issue was that the file I was uploading had a space in it, so we need to decode the URL first before uploading file to server, like:
var decodedURL = decodeURIComponent(file.uri);
const base64 = await fs.readFile(decodedURL, "base64");
Thanks...!
I'm attempting to access the Geometadb database which first involves download of the SQL library. I did that and then I got the Geometadb library.
library(GEOmetadb)
Next I need the Geometadb file which is where things start to go wrong. I issue this command as seen exactly in the tutorial: https://bioconductor.riken.jp/packages/3.0/bioc/vignettes/GEOmetadb/inst/doc/GEOmetadb.html
if(!file.exists('GEOmetadb.sqlite')) getSQLiteFile()
It should proceed to not only download a .gz zip file but also unzip the file. It downloads it but never unzips it. Instead I get the following error.
trying URL 'http://dl.dropbox.com/u/51653511/GEOmetadb.sqlite.gz'
Error in download.file(url_geo, destfile = localfile, mode = "wb") :
cannot open URL 'http://dl.dropbox.com/u/51653511/GEOmetadb.sqlite.gz'
In addition: Warning message:
In url(url_geo_2, open = "rb") :
cannot open: HTTP status was '403 Forbidden'
Just not sure what's going on here. Considering these are just the early tutorial steps I'm probably missing something really obvious but I'm hoping someone can help me out. Thanks!
I have some issue in uploading file using JQueryFileUpload with Backload.
I have added settings in web.config to upload large file like 1 GB file allow.
When i try to upload zip file around 150MB it upload successfully but when i try to upload file around 200 MB it showing following exception.
errorcode:12
error: Exception occured while storing the file
Can you please help me to get the solution? Why i am getting above error?
I have one other question : can we use UNC path to save image outside of website folder? If yes then how we can use?
Thanks in advance.
I get an error while i try to include the js file which is in the same folder. I tried cleaning my project but was of no use.
The console says "error loading path".
Please help.
var db={}
Titanium.include('windows/gallery');
var displayButton= Ti.UI.createButton({
title:'Display',
onClick:function(){
db.gallery.open();
}
});
I have used open function which opens the file. The open file works has no problem.
usually, we use require('files/myFile'), where :
Resources/files/myFile.js is the path (note that require doesn't use the .js)
The js file is NOT at the same level that app.js, but included in Resource folder.
So here, you should do
Titanium.require('windows/gallery');
instead of
Titanium.include('windows/gallery');
By the way, the previous method was Titanium.include('windows/gallery.js');
Note the .js at the end of the include version.
Is it a mobile or desktop version ?