Image upload fails

Discuss everything related to ApPHP DataGrid class. All versions. Any questions related to the ApPHP DataGrid developing or using should be posted to this forum.
Please, check out Knowledge Base first before you post a question.

Moderators: ne_moj, zewa

Forum rules
Posts are to be made in the relevant forum. Users are asked to read the forum descriptions before posting.

Image upload fails

Postby Bert on Jan 5th, '17, 19:18

Hi

Don't know what is going wrong but when I upload an image I get the following message:
There was an error while uploading, please try again!

I changed the access rights to 777

This is what I see in debug mode:
Code: Select all
FILES:

Array
(
    [stypicture_url] => Array
        (
            [name] => Bert.jpg
            [type] => image/jpeg
            [tmp_name] => C:\Windows\Temp\php5A34.tmp
            [error] => 0
            [size] => 61407
        )

    [stypicture_url_1] => Array
        (
            [name] =>
            [type] =>
            [tmp_name] =>
            [error] => 4
            [size] => 0
        )

)


I only choose the first image.

Can someone tell me what is going wrong?
Bert
Junior
Junior
 
Posts: 10
Joined: Jan 5th, '17, 10:48

Re: Image upload fails

Postby administrator on Jan 6th, '17, 10:50

What version of datagrid you work with?
User avatar
administrator
Site Admin
Site Admin
 
Posts: 5850
Joined: Jan 7th, '09, 23:18

Re: Image upload fails

Postby Bert on Jan 6th, '17, 15:02

The latest one.
I ordered 2 days ago.

Bert
Bert
Junior
Junior
 
Posts: 10
Joined: Jan 5th, '17, 10:48

Re: Image upload fails

Postby administrator on Jan 8th, '17, 12:25

Check if you defined this field as expected:
'FieldName_2'=>array('header'=>'Name_B', 'type'=>'image', 'align'=>'left', 'width'=>'X%|Xpx', 'wrap'=>'wrap|nowrap', 'text_length'=>'-1', 'case'=>'normal|upper|lower|camel', 'summarize'=>'false', 'summarize_sign'=>'', 'sort_type'=>'string|numeric', 'sort_by'=>'', 'visible'=>'true', 'on_js_event'=>'', 'target_path'=>'uploads/', 'default'=>'', 'image_width'=>'50px', 'image_height'=>'30px', 'linkto'=>'', 'magnify'=>'false', 'magnify_type'=>'popup|magnifier|lightbox', 'magnify_power'=>'2'),


Turn on debug mode and see what error description exactly dyou get.
User avatar
administrator
Site Admin
Site Admin
 
Posts: 5850
Joined: Jan 7th, '09, 23:18

Re: Image upload fails

Postby Bert on Jan 9th, '17, 07:33

Hello

I tried this in demo 2.1 and didn't changed the code.

I see no error.

In debug mode:
Code: Select all
Retrieve data for current mode #2:
select sql (total: 10 | time: 0.0023 sec.) SELECT demo_products.id, demo_products.name, demo_products.short_description, demo_products.long_description, demo_products.image_thumb, demo_products.image_big, demo_products.price, demo_products.available_from, demo_products.statistics, demo_suppliers.name as supplier_name FROM demo_products LEFT OUTER JOIN demo_suppliers ON demo_products.supplier_id = demo_suppliers.id WHERE 1=1 ORDER BY demo_products.name ASC LIMIT 0, 10

Retrieve data for foreign key:
select sql (total: 8 | time: 0.0021 sec.) SELECT id,name FROM demo_suppliers WHERE 1=1 ORDER BY name ASC

POST:
[prd__operation_randomize_code] => hsdnmtuyqeouf65og26q
[prd_mode] => edit
[prd_rid] => 5
[prd_page_size] => 10
[prd_p] => 1
[rtyname] => XPERIA X1,HTC
[riysupplier_id] => 5
[styimage_big] => img_bbn6o7tdnv.jpg
[rtyshort_description] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris adipiscing lacus ac odio. Nulla facilisi.
[rtylong_description] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris adipiscing lacus ac odio. Nulla facilisi. Morbi pretium, nibh vitae convallis hendrerit, orci mi auctor tortor, vel sollicitudin nibh lectus pharetra turpis. Praesent vitae ante a pede congue dictum. Curabitur placerat, urna vel mattis sollicitudin, magna augue venenatis orci, et euismod diam neque eget quam. Proin vitae odio. Quisque vel eros nec mi porttitor hendrerit. Suspendisse a urna. Mauris in est. Quisque viverra velit ullamcorper elit. Donec rhoncus mi vel urna convallis auctor. Integer faucibus lectus in magna. Integer commodo, est nec auctor iaculis, ligula urna rutrum augue, non congue mi risus tincidunt pede. Aliquam erat volutpat. Proin quis dui. Aliquam erat volutpat. Curabitur leo mauris, sodales sed, aliquet id, laoreet ac, sem. Integer aliquam, est ut scelerisque pharetra, justo lorem feugiat odio, vel tempus massa diam et lectus. Nullam consequat ligula in erat. Proin lacinia euismod lacus.
[styavailable_from] => 2008-12-31 01:38:35
[prd_frmEditRowstyavailable_from__nc_year] => 2008
[prd_frmEditRowstyavailable_from__nc_month] => 12
[prd_frmEditRowstyavailable_from__nc_day] => 31
[prd_frmEditRowstyavailable_from__nc_hour] => 01
[prd_frmEditRowstyavailable_from__nc_minute] => 38
[prd_frmEditRowstyavailable_from__nc_second] => 35
[stylast_updated] => 2008-12-06 01:38:35
[rfyprice] => 289.00
[rfystatistics] => 47
[rryis_featured] => No
[stydate_added] => NOW()
[prd_file_act] => upload
[prd_file_id] => image_thumb

GET:

FILES:

Array
(
    [styimage_thumb] => Array
        (
            [name] => Bert.jpg
            [type] => image/jpeg
            [tmp_name] => C:\Windows\Temp\php4F08.tmp
            [error] => 0
            [size] => 61407
        )

)
Bert
Junior
Junior
 
Posts: 10
Joined: Jan 5th, '17, 10:48

Re: Image upload fails

Postby administrator on Jan 9th, '17, 12:52

I don't see here error.
Show us your filed definition for image.
User avatar
administrator
Site Admin
Site Admin
 
Posts: 5850
Joined: Jan 7th, '09, 23:18

Re: Image upload fails

Postby Bert on Jan 10th, '17, 07:30

Hello

It is example 2.1
I didn't change the code:
Code: Select all
          "image_thumb"   =>array("header"=>"Thumbnail", "type"=>"image",      "req_type"=>"st", "width"=>"220px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "target_path"=>"uploads/", "max_file_size"=>"200K", "image_width"=>"120px", "image_height"=>"90px", "magnify"=>"true", "magnify_type"=>"lightbox", "file_name"=>"img_".(($mode == "add") ? $dgrid->GetRandomString("10") : $dgrid->GetCurrentId()), "host"=>"local", "pre_addition"=>"Click on image to enlarge...<br>"),
          "image_big"     =>array("header"=>"Big Image", "type"=>"image",      "req_type"=>"st", "width"=>"220px", "title"=>"", "readonly"=>"false", "maxlength"=>"-1", "default"=>"", "unique"=>"false", "unique_condition"=>"", "visible"=>"true", "on_js_event"=>"", "target_path"=>"uploads/", "max_file_size"=>"500K", "image_width"=>"240px", "image_height"=>"180px", "magnify"=>"true", "magnify_type"=>"lightbox", "file_name"=>"img_".(($mode == "add") ? $dgrid->GetRandomString("10") : $dgrid->GetCurrentId()), "host"=>"local", "pre_addition"=>"Click on image to enlarge...<br>"),
Bert
Junior
Junior
 
Posts: 10
Joined: Jan 5th, '17, 10:48

Re: Image upload fails

Postby administrator on Jan 10th, '17, 07:39

Did you created directory "uploads/"?
Added write permissions?

Do you see the image uploaded there?
User avatar
administrator
Site Admin
Site Admin
 
Posts: 5850
Joined: Jan 7th, '09, 23:18

Re: Image upload fails

Postby Bert on Jan 18th, '17, 19:44

Hi admin

I thought I changed the permissions.
But I thought!!

Bert
Bert
Junior
Junior
 
Posts: 10
Joined: Jan 5th, '17, 10:48


Return to ApPHP DataGrid

Who is online

Users browsing this forum: No registered users and 1 guest