Jump to content

Upload and delete images


pwFoo
 Share

Recommended Posts

Hello, 

I testing a page edit a form generated by form api (pure, unstyled).

Edit fields and also upload images works fine without JqueryCore module. To delete images that way JqueryCore module is needed.

Both works fine, but not together  :rolleyes:

I think with jQuery loaded the image is tried to upload via ajax and not handled by own code? Because without jQuery also image upload and save to page works fine.

Could someone give me a hint what is to do for frontend image upload?

Started to debug the problem with javascript console...

 POST http://server/pw/test/undefined 500 (Internal Server Error)InputfieldFile.js:294 uploadFileInputfieldFile.js:329 traverseFilesInputfieldFile.js:339 (anonymous function)
edit:1 Uncaught SyntaxError: Unexpected token <

I think "edit" is the used url segment and problem seems the file html output instead of handling the ajax upload correctly...

At the moment I#ve tested handling via ProcessPageEdit at line one.

<?php if ($config->ajax) { return $modules->get('ProcessPageEdit')->execute(); }?>
Link to comment
Share on other sites

By the way, there is missing some dependency handling via form api / fields.

form with file / image field and without manual loaded jQuery module.

 Uncaught ReferenceError: $ is not definedInputfieldPageTitle.js?v=102:11 (anonymous function)
InputfieldCKEditor.js?v=128:48 Uncaught ReferenceError: $ is not definedInputfieldCKEditor.js?v=128:48 (anonymous function)
InputfieldFile.js:1 Uncaught ReferenceError: $ is not defined
InputfieldImage.js?v=110:1 Uncaught ReferenceError: $ is not definedInputfieldImage.js?v=110:1 (anonymous function)
JqueryMagnific.js?v=1:4 Uncaught TypeError: undefined is not a function

So without jQuery form and upload works fine, because ajax upload fails *g*

But also delete images won't work without jQuery module.

Because I don't know how to handle the ajax upload I would be happy to get it disabled to get working file upload / delete with loaded JqueryCore module...

Link to comment
Share on other sites

Ok, problem caused because of a element I thought it's needed by the wysiwyg editor...

echo "<p style='display: none' id='PageIDIndicator'>{$page->id}</p>"; 

But it is important for file upload.

InputfieldFile.js

	/**
	 * Progressive enchanchment for browsers that support html5 File API
	 * 
	 * #PageIDIndictator.size indicates PageEdit, which we're limiting AjaxUpload to since only ProcessPageEdit has the ajax handler
	 * 
	 */
	if (window.File && window.FileList && window.FileReader && $("#PageIDIndicator").size() > 0) {  
                InitHTML5();  
	} else {
		InitOldSchool();
	}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...