-1

{"success":true} but fineuploader shows error

The php server script returns {"success":true}, and upload the file correctly, but in the webpage, it shows that there was an error uploading in red.

On Checking the console for the same i got this

fineuploader-3.2.min.js:

[FineUploader] Error when attempting to parse xhr response text (SyntaxError: Unexpected token < in JSON at position 1)

it something like this here

 <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined property: stdClass::$relation_value</p>
<p>Filename: libraries/Image_crud.php</p>
<p>Line Number: 527</p>


    <p>Backtrace:</p>
    <p style="margin-left:10px">
            File: /storage/ssd2/410/2722410/public_html/application/libraries/Image_crud.php<br />
            Line: 527<br />
            Function: _error_handler            </p>

            <p style="margin-left:10px">
            File: /storage/ssd2/410/2722410/public_html/application/controllers/<-COntroller name->.php<br />
            Line: 56<br />
            Function: render            </p>
    
        
            <p style="margin-left:10px">
            File: /storage/ssd2/410/2722410/public_html/index.php<br />
            Line: 315<br />
            Function: require_once          </p>
</div>{"success":true}

P:S It is working fine in my local (Windows 10) chrome ,FF on wamp server but when i uploaded in free hosting service i got the above error while uploading

Community
  • 1
  • 1
B Karthik Kumar
  • 230
  • 1
  • 8

1 Answers1

1

The php server script returns {"success":true}

No, it doesn't.

Your server is returning a bunch of HTML (which appears to be an error message), followed by a bit of JSON. JavaScript doesn't know what to do with all that HTML, so you should stop it from being output (by fixing the error).

ceejayoz
  • 176,543
  • 40
  • 303
  • 368
  • But my file uploads perfectly in webpage and as well as the path is saved in database @ceejayoz can you suggest any fix for it – B Karthik Kumar Oct 10 '17 at 13:02
  • @BKarthikKumar There's likely a difference in error reporting levels. See the linked thread for how to fix your specific error. – ceejayoz Oct 10 '17 at 13:03
  • but the error is not showing on the frontend it just visible if inspect or open the console while uploading the document or something like that and how to pinpoint the error – B Karthik Kumar Oct 10 '17 at 13:07
  • You've pasted all the details you need to pinpoint the error right here in this thread. `

    Severity: Notice

    Message: Undefined property: stdClass::$relation_value

    Filename: libraries/Image_crud.php

    Line Number: 527

    `
    – ceejayoz Oct 10 '17 at 13:29