iam using "lepozepo:cloudinary" meteor package to upload files to cloudinary from meteor app. the file is not uploaded and i am not getting any error. Appreciate if someone can point me what is going wrong. the following is the code.
Template.userprofile.events({
"change input[type='file']": function(e) {
console.log("iam in file upload")
files = e.currentTarget.files[0];
console.log("fiels value" + files)
Cloudinary.upload(files,function(err,res){
console.log("Upload Error:" + err); //no output on console
console.log ("Upload Result:" + res);
})
console.log("finsied" + files)
}
})
the following is the console output.
iam in file upload
fiels value[object File]
finsied[object File]
It turns out that the problem is with the google chrome browser. But in firefox its working fine. Not sure how to handle this in chrome.
Related
I have an excel file named Words.xlsx in public directory. Initially, during development mode, setting file path to /public/Words.xlsx worked fine but it failed in production mode saying that it can't read file path. Then, I read this and changed path to/Words.xlsx but I am still receiving the same error(below) in my function logs of vercel.
[Error: ENOENT: no such file or directory, open '/Words.xlsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Words.xlsx'
}
ENOENT: no such file or directory, open '/Words.xlsx'
Further, I am using this npm package to read excel file. Below is the code of how I use it:
const res1Sheet = await readXlsxFile('/Words.xlsx', { sheet: 1 });
How do I solve this?
Checking documentation, found this. Hopefully it might help someone who comes here one day.
Note: Only assets that are in the public directory at build time will be served by Next.js. Files added at runtime won't be available. We recommend using a third party service like AWS S3 for persistent file storage.
give full path such as public/Words.xlsx
Refer this documentation: https://docs.sheetjs.com/docs/demos/content#nextjs
you can use this sysntax:
const res1Sheet = await readXlsxFile('public/Words.xlsx', { sheet: 1 });
I am having issues uploading images to my meteorJs app using CollectionFS/ GridFs packages. The app works fine with image upload on my localhost but when I deploy to a production server and try to upload an image, I get a broken image, and when i visit the image url, i get this error
Error in method "/cfs/files/:value/:value/", Error: TypeError: Cannot read property 'Images' of undefined
at Object.httpGetHandler (packages/cfs_access-point/packages/cfs_access-point.js:357:1)
at Object.accessPoint.get (packages/cfs_access-point/packages/cfs_access-point.js:675:1)
at packages/cfs_http-methods/http.methods.server.api.js:581:1
I have tried several solutions like dropping the database or even deleting and creating a new server, but the result is still the same.
I am using these packages
cfs:standard-packages
cfs:gridfs
Update
Code Snippet
`//collection
postImages = new FS.Collection("postimages", {
stores: [new FS.Store.GridFS("postimages", {})]
});
//permissions
postImages.allow({
insert: function(userId, doc){return true;},
download: function(userId){return true;}
});`
Any suggestions on how to solve this?
Thanks
I wrote a sample Android app. I am getting 'Tesseract(native): Could not initialize Tesseract API with language=eng!' error.
I did include
compile 'com.rmtheis:tess-two:5.4.0'
in the gradle file
Also copied all 'data files' 3.04.00 version to 'tessdata' directory.
I debugged Java portion of 'init' code it seems to be working fine, it's failing inside 'nativeside'.
Any suggestions what could be going wrong with my code. Here are few lines of code I am using to init
final String lang = "eng";
TessBaseAPI baseApi = new TessBaseAPI();
File externalDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
String externalDirPath = externalDir.getAbsolutePath() + "/";
flag = baseApi.init(externalDirPath, lang);
The problem was not with tess-two, it was with my app, I deployed it on Marshmallow, it requires different way to get WRITE_EXTERNAL_STORAGE permission. I was not aware of it, now I fixed that issue my app is working fine.
i followed the Meteor Upload guide exactly , but i get this error when i load my uploading template.
any clues ?
Exception from Tracker recompute function: Cannot read property 'autoStart' of null
TypeError: Cannot read property 'autoStart' of null
at Template.upload.created (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/tomi_upload-jquery.js?b6bf3c0cc365d2eb8f9acc93ee3dcc4bfd892687:2569:29)
at null.<anonymous> (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2995:20)
at fireCallbacks (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1835:16)
at Object.Tracker.nonreactive (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:513:12)
at http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1832:13
at Object.Blaze._withCurrentView (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2043:12)
at Object.Blaze._fireCallbacks (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1831:9)
at Object.Blaze._createView (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1849:9)
at Object.Blaze._materializeView (http://genjurosama-199720.euw1-2.nitrousbox.com/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1853:9)
I've just tested it with Meteor for Windows and it works perfect for me.
Meteor.startup(function () {
UploadServer.init({
tmpDir: process.env.PWD + '/.uploads/tmp',
uploadDir: process.env.PWD + '/.uploads/',
checkCreateDirectories: true
})
});
Check what you are getting at process.env.PWD, I think issues comes from your enviroment. You need write permissions to that path. Also check out latest updates with meteor update.
Btw, it can be issue with nitrous enviroment.
I'm generating a few html-based reports from my Meteor app. Everything works beautifully on my development machine, but when I push it up to the server, the pdf files that are returned are empty.
I've installed wkhtmltopdf 0.11 using the instructions in this post. I've also tried 0.9.9. When I go to print, I don't get any errors: just a pdf file without any content.
Any suggestions as to what I'm doing wrong would be appreciated!
Here's the code I'm using to generate the pdf:
Router.route('/reports/printHTML/:fileID?', {
name: 'reports.printHTML',
where: 'server',
action: function(){
var headers = {
'Content-type': 'application/pdf',
'Content-Disposition': "attachment; filename=space_report_" + this.params.fileID + ".pdf"
};
this.response.writeHead(200, headers);
var wk = Meteor.npmRequire('wkhtmltopdf');
var thisReport = PastReports.findOne({_id: this.params.fileID});
if(thisReport){
var html = thisReport.body + '<head><link rel="stylesheet" href="' + Meteor.absoluteUrl() + '/bootstrap.css"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.6/fullcalendar.min.css"></head>';
var r = wk(html, {pageSize:'letter', orientation:'Landscape', zoom:1, B:"5mm", L:"5mm", R:"5mm", T:"5mm",}).pipe(this.response);
} else {
console.log("No report to print: " + this.params.fileID);
}
}
});
The user running your meteor app should have wkhtmltopdf in its PATH, so you might want to try the following:
Login as the user running your meteor app and verify the PATH where wkhtmltopdf is located with either which wkhtmltopdf or whereis wkhtmltopdf
Login as the user running your meteor app and verify your PATH with echo $PATH
Set your PATH to contain the same path that is used by wkhtmltopdf
# inside ~/.bashrc or ~/.bash_profile
export PATH="$PATH:/usr/local/bin"
Alternatively, you can create a symbolic link to wkhtmltopdf to an existing directory in your PATH. If wkhtmltopdf is installed under /usr/local/bin and you already have /usr/bin in your PATH:
ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
Also, be sure to check the browser's console or server logs for errors.
I had a similar issue with PhantomJS. The bundle included my OSX binary of phantomjs instead of Ubuntu version.
As Chip suggested, try to change the path accordingly to your OS distribuction.