File upload fails: is not valid file
See original GitHub issueUploading fails with “Application error: Error /Users/user/Library/Developer/CoreSimulator/Devices/11C75134-AC52-46B8-87F6-58A61B8A1E0C/data/Containers/Data/Applicatio … 282.jpeg is not a valid file:// url undefined” on iOS emulator. The path is correct and a valid image can be found at this path.
tns-core-modules: 1.7.1 tns-ios : 2.0.0 tns-android: 2.0.0 nativescript-background-http: 0.0.3
The code snippet:
import cameraModule = require('camera')
import imageModule = require('ui/image')
import enumsModule = require('ui/enums')
import fsModule = require('file-system')
import bgHttpModule = require('nativescript-background-http')
const options = { width: 300, height: 300, keepAspectRatio: true }
const format = enumsModule.ImageFormat.jpeg
cameraModule.takePicture(options).then(imageSource => {
let contentType = `image/${format}`
let base64String = imageSource.toBase64String(format)
let savePath = fsModule.knownFolders.documents().path
let fileName = 'img_' + new Date().getTime() + '.' + format
let filePath = fsModule.path.join( savePath, fileName )
if ( imageSource.saveToFile( filePath, format ) ) {
var session = bgHttpModule.session('image-upload')
var options = {
url: 'http://192.168.99.100:8003',
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
'File-Name': fileName
},
description: '{ \'uploading\': ' + fileName + ' }'
}
let task = session.uploadFile(filePath, options)
task.on('progress', logEvent)
task.on('error', logEvent)
task.on('complete', logEvent)
function logEvent(e) {
console.log(e.eventName)
}
}
})
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Error: File upload failed. (file name) Invalid File Name
Answer: · Ensure you are logged into the Files Folder and are in the folder in which to upload the file. · In...
Read more >Uploaded file is not valid for copy... - DirectAdmin Forums
Whenever I upload an image through DA it says: Uploaded file is not valid for copy. When checking something deeper into the error...
Read more >No longer able to upload files due to error message
When uploading files to an existing SharePoint folder, receive the following message 'The URL <file name> is invalid.
Read more >File upload form not valid - django - Stack Overflow
The form loads fine and I can upload a file but after 'submit' I can not get past Fileform. is_valid() in the view....
Read more >Error message on upload: "No file uploaded or invalid file type!"
Error message on upload: "No file uploaded or invalid file type!" ... This message has two common causes: ... PKP software uses MIME...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
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
@roblav96 yes this is resolved with this commit
the error eim getting is with the name being sent as whole path. I edited in the plugin and made a pull request in the repo