How to upload image using object function?
When I upload image with some form elements it gives internal error 500. If I remove file element from form then the data is saved with no error.
This has nothing to do with AngularJS. It is your server failing to be able to process the file in the Request. For example, most common cause is the folder the server tries to put the image in not accessible because of security settings in the web-server.
AngularJS is not raising a 500 error, it has to be Web Server raising that error
Check the logs that the your web-server may have.
Related
I use react-dropzone-uploader (https://www.npmjs.com/package/react-dropzone-uploader).
It allow upload images through dropzone.
This solution was great.
Usually, when I choose images, it upload files to https://httpbin.org/post (for validation (?)).
But now whichever image I choose (even those that were successfully uploaded earlier), this request fails with status 413 (Request Entity Too Large Error). My images aren't large.
This error occurs both in my locale solution and in the examples from quick start tutorial.
You can see error on https://react-dropzone-uploader.js.org/docs/quick-start. Just try to upload some images and see Network in DevTools.
Recently I have revamped a website which is created on a development server. Then after that i started migrating it onto the main server. Initially I got a unicode error while uploading the database on the live server. I googled it and found a solution on stack overflow itself (#1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’). I used the method suggest by sabba and it worked. Later when I Changed the config file and loaded that link. Its giving me a 503 error.. It error is as follows:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Additionally, a 503 Service Unavailable error was encountered while trying to use an Error Document to handle the request
Go through the steps and check it,
Enable WP_DEBUG
But since the 503 error often locks you out of your WordPress admin, we shall use WP_DEBUG and WP_DEBUG_LOG, WP_DEBUG_DISPLAY and #ini_set constants available to WordPress.
To enable debug mode in WordPress and write errors to a log file, follow these steps:
1. Open the wp-config.php file
2. Scroll down to where WP_DEBUG is defined. It looks like this define ('WP_DEBUG', false);. If it is missing, we will add it just above the line that says /*That's all, stop editing! Happy blogging.*/
3. Insert the DEBUG magic codes. Just change the above define ('WP_DEBUG', false); code to:
define ('WP_DEBUG', true);
define ('WP_DEBUG_LOG', true);
define ('WP_DEBUG_DISPLAY', false);
#ini_set ('display_errors', 0);
4. Save changes
Now, reload your site to provoke the error. Next, locate a file known as debug.log inside your wp-content folder in your WordPress directory.
This file contains all the errors on your website. If your 503 service unavailable error is caused by a custom code snippet, it will show up somewhere with details of the error.
Eliminate/replace the problematic code and reload your site. If the 503 error persists, the problem could lie in your web server.
I am working on a project and needed to collect data using open data kit. I have created a server using google app engine, but when uploading the form to the aggregate server, I get this error:
sample-Error: Not Found (404) at
http://odkproject- 207015.appspot.com/ODKAggregate/submission?deviceID=imei%3A864898033928120
404 is returned if the form you're submiting is does not exist on the server.
You have to delete all forms and load them back.
Hope it fixes your issue.
How to track CSV downloads with Angular/Node js?
I am downloading a CSV file(from Node) using Content-Disposition=attachment. My download should always initiate from server side (I don't want to do the download using anchor tags since the data can be quite large and cause memory issues).
But, what are the possible ways of tracking the download and to know when the download is over?
Here are the steps I have followed for tracking the download :
Submitting a form with required parameters.
In my server(node js), getting the parameters and using them to fetch data from external service.
formatting the data and starting the download by using streaming(Content-Disposition is set to attachment and Content-Type is set to application/download).
I tried setting a cookie from server when the download starts and in the client side I am checking for the cookie in regular time intervals to track the download progress.
But, the problem with tracking downloads with Cookie is that : if the users have disabled Cookie in their browser, then download tracking will not work.
Executing this code in Safari doesn't work, but it works in chrome and firefox:
var pathToFile = path.resolve('./scripts', file);
element( by.css('input[ng-file-select="onFileSelect($files)"]')).sendKeys(pathToFile);
In digging around it looks like it's not possible to interact with file inputs in this way in Protractor running on Safari. Does anyone know of a workaround in Safari to put a file path in an input?
This is due to a leaky abstraction, which requires a Safari specific solution:
I guess the workaround for those that really want to do file upload for SafariDriver would be not to do it natively via SafariDriver but by using external code libraries to perform the upload via HTTP/HTTPS (POST) requests (combining any other form data in addition to the file being uploaded/sent), then get response and check whether upload succeeded or not, then go back to SafariDriver code and navigate to next page to check upload succeeded or not, and/or to continue from there for the next steps in the automation.
This approach would be similar to the file download method using HTTP requests externally that has been mentioned in various posts in WebDriver and Selenium user Google groups. Here, it's just the inverse, doing upload instead of download.
Though if the upload requires a session (cookie), then you can extract Selenium session cookie and use with HTTP request. Or if session is stored with session ID in URL, extract that and pass along with HTTP request.
References
Selenium Issue 4220: The SafariDriver does not support file uploads
How to upload file using Selenium when the file input is hidden?
Access is denied error in IE while file uploading
Changing the value of input file
Chrome file upload bug: on change event won't be executed twice with the same file
Selenium IDE 1.4.1 throwing security error when uploading a local file
Dynamically submitting a file upload form in IE10 using jQuery