I need help in finishing a Wordpress plugin I'm developing. I'm almost finished, but I am experiencing some problems and I can't figure out why I get the errors. I am posting the link to the plugin so you may download and test. I think it's the best way to discover what is wrong
What does it do?
The plugin lets you select a image and stores the image URL in a custom property.
You can then retrieve this custom property in your template design.
When you install it, it will add two custom metaboxes to POST and PAGE edit screen in the backend. Each custom property has a button for selecting image. When you click this button, a UI Dialog box opens and displays files and folders.
Once you have selected an image and saved the POST / PAGE, you can retrieve the custom property and use the image url in your template design.
Installation
Just dowload the plugin from here: http://stiengenterprises.com/download/wp-filebrowser
Unzip and copy the folder to you/plugin dir, then activate the plugin.
Known issues
1) 404 Not found
When clicking the 'Get image url' button, jQuery triggers jQuery("#fileBrowser").dialog() which then loads 'fileBrowser.php'.
At line one, I have the following code:
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');
This is what is causing the 404 Not Found error. This line did not cause any troubles in WP v2.9.1.
2) File upload
I've not been able to use jQuery Form Plugin to uplaod files. I would really like to use this for file Upload. I do not want to use Flash.
I have had a go at it, but no luck :( You can see my Stackoverflow ticket here:
Does anyone have a good example / tutorial on how to use jQuery Form Upload?
I would really really appreciate any help you can give me :)
UPDATE
after testing Todd's suggestion, it works on my local installation of WPMU. But I still receive an error message on my web server:
Warning: require_once(WP_HOME/wp-blog-header.php) [function.require-once]:
failed to open stream: No such file or directory in
/home/mysite/wpmu/wp-content/plugins/wp-filebrowser/fileBrowser.php on line 4
Fatal error: require_once() [function.require]:
Failed opening required 'WP_HOME/wp-blog-header.php'
(include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in
/home/mysite/wpmu/wp-content/plugins/wp-filebrowser/fileBrowser.php on line 4
Line 4 is require_once(WP_HOME.'/wp-blog-header.php');
404 Problem:
You do not have to use the
$_SERVER['DOCUMENT_ROOT']
In the WordPress wp-config.php there are the following constant:
define('WP_HOME','http://example.com');
Use these instead and that should fix your problem.
require_once(WP_HOME.'/wp-blog-header.php');
File Upload
This should get you pointed in the right direction:
http://ppshein.wordpress.com/2009/05/22/upload-files-with-jquery-ajax-and-php/
Thanks to Pavel Velikiy, I have fixed the 404 problem.
See separate thread here.
The solution was to add header('HTTP/1.1 200 OK') just after require_once.
As for upload part, I'll deal with that later :)
PS. I'm answering my own solution so I can mark it as solved.
Related
When I am uploading images in WordPress media. It shows error.
error showing: An error occurred in the upload. Please try again later.
And also any of the images is not showing.
Here I click to attched image to the page but there is no image
Not any of the images are showing here only wp loader is rotating.
This issue comes when I make a second copy of wordpress site on the same server. I have given Site URL and Home URL correctly and also given permission to the all the folder. Yet this issue not resolved. but other wordpress site is working fine on this server.
There are many reasons to do not upload images in your WordPress media library.
That might be the issue of permission of your directory or as you said you have given permission already then you should check you upload path.
There are also some other steps to check and solve your issue.
Please follow this link. It will guide you step by step process and hopefully work for you.
I have a very funny problem.
I installed wordpress 3.9.1 on my server, I didn't change any wordpress file. I just unzip files and add to ftp.
when i tried to add some media file wordpress media uploader show to me this error line :
Here is Jpg from error message
http://funnyfennel.net/error.jpg
ERROR : HTTP error.
I think problem may be when you upload an image, there is a chance that your comments will show in the response coming from ajax which causes error to show. I have been through the same problem and find that my comments are showing in the response.when i removed it images are uploading nicely.
If you're still getting the HTTP Error, ask your hosting provider to disable the PHP module imagick- it fixed it for me.
Hi I have the following problem. I use jQuery file upload plugin and want to implement file uploader in one of my website pages. I am using the UI version so the thing is working, the files are uploaded but when i try to delete them i have an 404 error on the request. I am using POST request. The problem is that I get 404 header error and that is screwing the code. My page is responding with the right JSON data but the header is 404 I searched the whole [uploader class][3], but i can't find where the header is set and even if I comment that 404 line
if (!$this->is_valid_file_object($file_name)) {
return $this->header('HTTP/1.1 404 Not Found');
}
Nothing happens so I cant understand where in which javascript file or in the upload handler class the headers go wrong and how to fix the problem.
So my ajax return is like follows:
_method:DELETE
/my_domaing/some_page/uploadAction/file:action_test_file_3%20%281%29.doc
POST 404 Not Found text/plain jquery.js:8706 Script 991 B 360 B 20 ms 20 ms
I think the problems comes from my framework cause in plain php I can upload and delete files. But when i open the page in my browser with that link I can see the JSON response which is:
{"file":{"name":"action_test_file_3.doc", "size":61440,
"url":"http:\/\/my_domain\/files\/action_test_file_3.doc",
"deleteUrl":"http:\/\/my_domain\/some_page\/uploadAction\/file:action_test_file_3.doc\/
_method:DELETE\/file:action_test_file_3.doc\/_method:DELETE","deleteType":"POST"}}
I don't know what I need to get so the file be deleted, but I know that the header information is gone wrong cause I can open it and see the information but the POST request sees the 404 error and just doesn't do nothing.
The framework I use have a .htaccess rewrite rule which is the following:
RewriteEngine On
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|htc|txt|doc|docx|xls|xlsx|pdf|htm|html|
bmp|flv|xml|zip|plist|ipa|woff|ttf|svg|eot)|^design(.*)|^sks(.*)$ index.php
But I don't think the rule has anything to do with this upload. My framwork uses Smarty. I really can't find the way to solve the problem the uploading is working perfectly so why not the deleting. And I have write/delete permissions on the directory.
I don't get any javascript errors and in my php log there are not errors regarding this page.
So I think the problem is with the header information and if it returns 404 the file is just not deleted that is all. But I can't understand where and how this is happening.
So feel free to ask me anything but I can't send you a live demo cause it is a developer server, but I will do anything to try and resolve this problem cause I am struggling with it for almost 2 days. Any help is and will be appreciated!
I am new to open cart. I have uploaded a store from local to live but it says the following error
Notice: Error: Could not load language english! in /home7/neotjans/public_html/EBook/system/library/language.php on line 39
I have checked and uploaded the english.php file to catalog/language/english as it was mentioned in another tutorial but the error is still there.
I had also the same problem. You are just missing the language file in catalog/language/english/english.php. Grab it from the default file and upload it back. It will solve the problem.
If this doesn't work for you then follow the second method here
Copy web_payment_software.php file from admin\language\english\payment
Paste to your language folder. Sample: admin\language\vietnamese\payment
Note: web_payment_software.php in folder "admin\language\english\payment"of OpenCart 1.5.1.3 version. Download full package to copy it!
No matter what I change in this script, when I go to upload the file, the page is looking for the action do-nothing.htm. This is what the ACTION of the plugin is set to in the downloaded example, but I have changed it.
I have also changed some lines in the Javascript to see if I could get something working, but nothing. In fact I can't seem to find any reference to do-nothing.htm yet the console still gives me a 404 error do-nothing.htm not found. Any ideas?
the example works.