⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Image CRUD - FineUploader error and 404 error



juliette

juliette
  • profile picture
  • Member

Posted 16 December 2013 - 16:43 PM

Hello,

 

I'm starting using Image CRUD (I already use Grocery CRUD).

When I try to upload an image, it fails instantly.

 

In the console panel, it seems that FineUploader stops because the url upload_file can't be reached, so the XHR response only contains the code of the 404 error:

 

[FineUploader] Processing 1 files or inputs...

[FineUploader] Sending upload request for 0 http://localhost/osu/borehole_crud/example1/upload_file?qquuid=70233647-60e5-4470-b9ac-a6fca85f2e23&qqtotalfilesize=44461&qqfile=jf.jpg

404 Not Found fineuploader-3.2.min.js

[FineUploader] Error when attempting to parse xhr response text (SyntaxError: Unexpected token <)

 

In the script panel it seems to stop on the getCookieNames function of fineuploader-3.2.min.js.

 

The problem isn't about permissions nor upload file size because file upload in this directory works with Grocery CRUD ...

 

Thanks for your help!


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 17 December 2013 - 07:39 AM

Hello [member='juliette'] and welcome to the forums,

 

It seems that there is a problem with your installation. Can you try to install again imageCRUD to your project from scratch? If you still having issues, can you please post the page source (right click -> view page source) of your page?

 

Thanks

Johnny


juliette

juliette
  • profile picture
  • Member

Posted 17 December 2013 - 09:01 AM

Hello Johnny and thanks for your reply,

 

I installed Image CRUD again, and I encounter the same error.

Here is my source code (I let the whole page).

 

You can see that the jquery files are not the same as in Image CRUD : I use jquery-1.7.2.min.js and jquery-ui-1.8.18.custom.min.js. (actually I implemented the Grocery CRUD unset_jquery() and unset_jquery_ui() methods in Image CRUD.)

I tried with the image CRUD version of these files, but it didn't change anything ...

 

Juliette


juliette

juliette
  • profile picture
  • Member

Posted 27 December 2013 - 11:24 AM

Hello,

 

Actually all URLs can't be found: upload_file, insert_title, delete_file, ordering (ordering url can't be found but images can be moved ..), ajax_list ..

 

For example, when I try to delete a file I get this error:

"NetworkError: 404 Not Found - http://localhost/osu/borehole_crud/example1/delete_file/3"

But if I enter this URL in the browser, it "works" and the corresponding image is deleted, as well as the record in the table.

 

I keep on searching the problem ..


juliette

juliette
  • profile picture
  • Member

Posted 07 January 2014 - 09:48 AM

Hello,

Now this is OK. There were several problems:

 

1/ The different URLs were not found because they were wrong: a segment was missing due to the fact that I work in subfolders. I solved the problem by looking at this: https://github.com/scoumbourdis/image-crud/issues/6

In libraries/image_crud.php I modified getState() and _get_delete_url().

 

In getState():

$rsegments_array = $this->ci->uri->rsegment_array();

/* Added part */
$segments_array = $this->ci->uri->segment_array();
$diff_uri = count($segments_array) - count($rsegments_array); 
if($diff_uri)
{
	$add_uri_array = array();
	for($i = 1; $i <= $diff_uri; $i++) $add_uri_array[$i] = $segments_array[$i];
	$add_uri = implode('/',  $add_uri_array);
	$add_uri .= '/';
} else $add_uri = '';
/* End of added part */

And in the rest of the function, I added $add_uri in all site_url(), for example:

$upload_url = site_url($add_uri.$rsegments_array[1].'/'.$rsegments_array[2].'/upload_file/'.$rsegments_array[3]);

I did the same in _get_delete_url().

 

2/ Then I encountered several issues to upload a file:

- I had a NOT NULL field in my table, and it caused an error at the insertion of the file_name in the table.

- if my primary key is not an auto-increment field, the insert statement also fails.

 

3/ 2 notices that are not in the documentation and seem important:

- the ordering field has to be numeric. I thought that it could be a character field depending on which images would be sorted.

- the relation field has to be numeric. I did not find yet how to modify the code so that character fields could be accepted. And it seems that a category should be provided in the URL otherwise it fails.

 

Finally, if the table contains other fields of description, they can neither be read nor edited, this would be great to able to do that! ;)

 

Juliette