I'm using Dropzone.js for my website. I'm in the need of uploading bigger files than the default maxFilesize of 500MB.
I tried to change the number in the .js file. Now the file seems to be accepted but there is no (visible?) progress in the upload. The file has no red cross and is stuck at zero percent of the upload.
Any ideas what I might be doing wrong? Or is this some kind of bug?
I just tested it in Chrome and it worked fine. (Which browser are you using?)
It might be that your upload is just taking so long that you don't see an update immediately.
First things first: you shouldn't change properties in the .js file itself. This way you wont be able to upgrade to a newer version of Dropzone without headaches. So configure your dropzone the way it's recommended on the website.
About the upload,... it's really hard to tell what might be wrong without a look at it. What I suggest, is that you add some kind of debugging information on the status updates, to see if it's really just your upload being very slow.
Try this code and see if it doesn't solve your problem:
<form id="my-dropzone" action="/target" class="dropzone"></form>
<script>
Dropzone.options.myDropzone = {
maxFilesize: 500,
init: function() {
this.on("uploadprogress", function(file, progress) {
console.log("File progress", progress);
});
}
}
</script>
If you can see the console output in regular intervals then the upload is working fine but just takes a while to finish.
The Dropzone.options must be out of document.ready or it wont work.
Just for the record, because this post is from along time ago.
I solved it changing in the php.ini file parameter 'post_max_size' from my server. Maximum size of POST data that PHP will accept.
And then reboot the Apache Server.
Add to httpd.conf file:
<Directory "/tmp/">
LimitRequestBody 256000
</Directory>
After, restart apache!
Reference: https://www.cyberciti.biz/faq/apache-limiting-upload-size/
Related
I'm using jquery-file-upload plugin to upload some files.
I have a bind to the add callback where I collect the files to upload and on form submit i'm issuing the 'send' command to begin the upload.
The problem i'm facing is that the fail callback is called upon successful upload with the following error message:
"Uploaded bytes exceed file size"
can anyone explain me what does this error mean? and why I keep getting it?
I appreciate the help.
10x
I was getting this error as well but I was setting the dataType value to be JSON.
I remove the dataType open and stopped getting this error.
This only worked for me as I was not getting Json back
I was also getting this kind of error. And it took me a whole day to find the cause of the problem. So, I changed a lot of things and among them:
I explicitly set "upload_tmp_dir" directive in php.ini - it was
irrelevant;
Checked and increased values for both "upload_max_filesize" and "post_max_size" directives in php.ini - it was also not the cause.
Created all the folders in my document root directory: "images/" and "images/temp/" - didn't help though is necessary.
The problem was that there was a separate root for AJAX post request for image preliminary upload (Silex/Symfony library), and in the example I copied, the author (deliberately) left out the "url" option from the request, as in:
$('#fileupload').fileupload({
dataType: 'json',
url: '/post/upload', // this was missing
replaceFileInput: false,
fileInput: $('input:file'), ...
At the same time, the form, where this element belonged to, had its own route set to "/post/" and, with "url" option missing, the plug-in, obviously took it from the parent form.
As such, no controller was called, the uploaded file was unprocessed, and the text of the error was misleading.
PS. This "auto substitution" by the plug-in might also affect the methods used for request (PUT or POST), as I used both in controllers - "PUT" for the form and "POST" for the fileupload management, but I didn't check.
I tried reviewing all available messages in console and I found this
always: function(e, data) {
console.log(data.jqXHR.responseJSON.files[0].error);
In my part, I got the error due to the file I'm uploading exceeds the upload_max_filesize directive in php.ini
The won't give the you the exact error.
console.log(data.messages);
Make sure your form only has inputs that are what AWS expects. Do not add extra form fields of your own. Or if you do, remove them with JS before the AWS upload begins.
I used to use a web hosting with cPanel and there is no problem with drag and drop image uploading ( every file is less than 2MB ).
The uploading method is like
<img src="data:image/jpeg;base64,xxxxxxx...">
and I post it on url into php to encode to a image file.
After I moved my website to another web hosting and some problem just happened with drag and drop uploading.
If any file size is larger than 730KB, the uploading will be fail.
I have google a lot, including modify php.ini like post_max_size, upload_max_filesize, even set ini_set('memory_limit', '256M') and ini_set('post_max_size', '8M') in php file, it's not working at all.
If your new hosting is not administrated by you, then they may have restricted the ability to set ini configs from the PHP scripts, and lowered the limit file uploads.
Also memory_limit is not the directive you need, is max_upload_size and post_max_size.
memory_limit limits the amount of RAM that PHP can consume before fatal erroring.
I have found where the problem is.
based on my uploading method is drag and drop image, i tried to count post length with using "alert(encode.length)" and i found that if length of every file is longer than 1,000,000, it will shows error.
so i tried to find the value 1,000,000 in phpinfo()
it's
suhosin.post.max_value_length
so in
/etc/php5/conf.d/suhosin.ini
i change it 1,000,000 to 10,000,000 and remove the mark then restart apache, it works fine now.
please take a look , pictures cannot be loaded
[link]http://markizasklep.website.pl/altea/agency-index.html
when i start website at localhost there is everything ok, but when i start from my ftp server i think JavaScript doesn't work. I've checked size of paths (jpg - JPG , etc.) and it is not a reason i think. Have You got some ideas ?
To edit file i am using Dreamweaver ,maybe it is important ;)
If you open the developer tools e.g. in chrome you will see that the browser doesn't find at least two files: prettyPhoto.css and jquery.prettyPhoto.js.
Try uploading them.
First: Next time provide smaller sample :) and second You give 404 for jquery.prettyPhoto.js so reason is probably that you have this file on localhost but on on server.
I logged in to my FTP from Filezilla and tried to open a JS file, and it gave me the following error:
Script: C:/.../slider.js
Line: 1
Char: 1
Error: 'document' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
I have jQuery linked to the .php file as well...'document' comes from:
$(document).ready(function() {
//Code is here...
});
I tried downloading the file and opening it, I tried removing the $(document).ready();, I tried removing jquery (which by the way, when I opened the jQuery file it gave me the same almost the same error). Any help is appreciated. Thanks!
EDIT:
One of the tags for this post was "asp.net", but to be honest I don't even know if it is related to asp.net...
I had the same issue and fixed it by doing the following in Filezilla:
Go to Edit > Settings
Go to the 'File editing' section
Under 'Default Editor': Ensure that Notepad++ is selected as your custom editor
Change the radio button from 'Use filetype associations if available' to 'Always use default editor'
You say that you're right clicking and clicking "View/Edit", and it throws that error.
The error is occurring because Windows is executing the script, and the script has a problem (because it relies on another script being loaded).
So although you may be clicking "View/Edit", and expecting that this will open the file in Notepad++, what it is actually doing is assuming that "View" means "Run the script".
Clearly, Notepad++ is not the default action for this file type, or at least it isn't according to Filezilla. Maybe the default action isn't actually set the way you think it is, or maybe it's Filezilla that isn't respecting your default action.
The solutions:
If Filezilla has an option "Open with..." that allows you to pick the program to open the file with, then use that and select Notepad++ manually. Even better, if it has the option to then make that the default, then tick it, and the problem should be solved permanently.
Alternatively, just download the file to your local machine before trying to open it.
I got this working in FileZilla by doing the following: -
Edit -> Settings
File editing -> Use custom editor [file path to notepad ++] then
|___File editing -> Filetype associations
Adding the line -> js "C:\Program Files (x86)\Notepad++\notepad++.exe"
Click OK to save changes
This will stop windows script host from attempting to run the file and open in notepad++.
While the question has effectively been identified previously in the post I hope that someone finds this 'how-to' useful.
This is not a programming problem. It's a file association problem - Windows is trying to execute your .js file instead of opening it in an Editor.
See this question on SuperUser: running-javascript-files-js
There's also some explanation of the error here.
Check your file associations again. Try restarting your machine. You will get more help if you ask this type of a question on SuperUser.
It's worked for me after adding the file association.
Edit -> Settings
File Editing -> Select Use filetype association if available checkbox.
Select Filetype Associations -> add association here
js "C:\Program Files\Sublime Text 3\sublime_text.exe"
OK
Note: change association according to your text editor application.
Just follow these steps. It is an easy one to do. Change the default file type for opening the js files.
Edit -> Settings
File editing -> Filetype associations
Adding the line -> js "C:\Program Files(x86)\Notepad++\notepad++.exe"
That's it. Finally, Click OK to save changes.
It will work afterwards.
I am trying to use jquery's ajax $.get(...) function to send a request to my server and have it return some data. I am using the following code:
$.get("php/getRocks.php", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded: " + data);
});
Instead of getting the the data back, it just returns the entire php file as a string. Am I doing something wrong? Thanks for the help.
Is PHP installed on your server? This is a server issue. For some reason your .php file isn't being handled properly and it is returning the PHP code in plain text.
This is in response to:
Well, I seem to have solved the
problem, sort of. Apparently, if I
access the site localy, php doesn't
work, but if I use the domain name, it
does. Anyone know why? Or better yet,
a way to fix this?
Thanks to everyone for the help!
When working locally (and it always is a good idea to do so before uploading to a live environment) you need to setup PHP on your computer so that it can run the pages you require. A browser will not do it for you as it is a server side technology. You can download a package like Uniform Server, that will give you a full server environment for you to work with.
I have the same problem (using MAMP on mac), and while I haven't solved it, I am a step closer.
Basically, it would appear to have something to do with subdirectories/document root. If I set my url as getRocks.php (and move my script there), it works (I get content back), but if I get it as php/getRocks.php, it does not work (I get the php code back).
Perhaps MAMP is doing something add with response types within subdirectories? Am going to take a further look, but hopefully this helps lead you in the right direction.
Well, I seem to have solved the problem, sort of. Apparently, if I access the site localy, php doesn't work, but if I use the domain name, it does. Anyone know why? Or better yet, a way to fix this?
Thanks to everyone for the help!
1st. make sure you have php installed
If you are using linux / apache2 and php 5
u need to compile/install apache and load php via dso
eg:
LoadModule php5_module modules/libphp5.so
In my humble opinion it has got nothing todo with your jQuery but your web server installation/config:
If it is apache make sure you add this line in your conf file:
AddType application/x-httpd-php .php
More reading about php and apache if you are using php anad apache in linux/nix eg: http://dan.drydog.com/apache2php.html