Extension on upload doesnt show
See original GitHub issueHi I have uploaded a file using reactjs and nodejs. Using the following code:
const tus = require('tus-node-server');
const serverFile = new tus.Server();
serverFile.datastore = new tus.FileStore({
path: '/files'
});
const express = require('express');
const app = express();
const uploadApp = express();
uploadApp.all('*', serverFile.handle.bind(serverFile));
app.use('/uploads', uploadApp);
const host = '127.0.0.1';
const port = 9000;
app.listen(port, host);
And for the reactjs component:
<input type={'file'} onChange={(e) => {
// Get the selected file from the input element
var file = e.target.files[0]
// Create a new tus upload
var upload = new tus.Upload(file, {
endpoint: "http://localhost:9000/uploads/",
retryDelays: [0, 1000, 3000, 5000],
metadata: {
filename: file.name,
filetype: file.type
},
onError: function(error) {
console.log("Failed because: " + error)
},
onProgress: function(bytesUploaded, bytesTotal) {
var percentage = (bytesUploaded / bytesTotal * 100).toFixed(2)
console.log(bytesUploaded, bytesTotal, percentage + "%")
},
onSuccess: function() {
console.log("Download %s from %s", upload.file.name, upload.url)
}
})
// Start the upload
upload.start()
}}/>
It uploads the file fine, however it doesn’t upload the file with the adequate extension? I am new to tus and was using other modules before this. Where am I going wrong? I am using serverFile as there is already another server specified in the file elsewhere:
const server = require('http').Server(app);
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
image extension is not showing in PHP file-upload
It works but there is one small thing that doesn't want to do its job. The extension that I'm trying to get is...
Read more >Since Latest Mac OS, can no longer upload any files in Chrome
Since Latest Mac OS, can no longer upload any files in Chrome. I have disabled extensions as suggested. This does not work. I...
Read more >Safari not opening "upload file" pop up w… - Apple Community
When I try to upload a file to a website, Safari won't open the pop up window to allow me to browse my...
Read more >Uploading Browse feature doesn't display files in folder?
Am on a website, iPage, and want to upload a file to their FileManager. I use their Browse function to find and select...
Read more >6800 - Chrome doesn't set Content-Type for file upload when ...
I get this on Chrome 7.0.517.44 and 8.0.552.215 when uploading a file with no extension. ... It works for the same file if...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome, thanks a lot @Acconut !
@adrienfloor You need to put the content type into the metadata, like this:
See https://github.com/tus/tus-node-server/blob/2f800162e8ea6e60682f0bc62b8fe5597dbc17a9/lib/stores/S3Store.js#L138