Jump to content

Image/File Upload Problems without Errors


alanp

Recommended Posts

had the same error after 2 days of searching and trying is this the solution 

/etc/apache2/mods-available/fcgid.conf

<IfModule mod_fcgid.c>

  FcgidConnectTimeout 20

  MaxRequestLen 104857600  // you have to increase the value 

  <IfModule mod_mime.c>

    AddHandler fcgid-script .fcgi

  </IfModule>

</IfModule>

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...

I fixed this issue in a different way: 

I saw the ajax request printed a warning "Cannot set max execution time limit due to system policy", so I commented out line 955 in core/ImageSizerEngine.php

seems to work

j

Link to comment
Share on other sites

  • 5 months later...

Had the same problem with nginx 1.10.3, and here is the solution I found from StackExchange:

Quote

Be certain you have included your increased upload directive in ALL THREE separate definition blocks (server, location & http). Each should have a separate line entry. The result will like something like this (where the ... reflects other lines in the definition block): 


http {
    ...
    client_max_body_size 20M;
}    

This above block may be found from /etc/nginx/nginx.conf file. The following block was in /etc/nginx/conf.d/default.conf in my server environment.


server {
    ...
    client_max_body_size 20M;
}

location / {
    ...
    client_max_body_size 20M;
}

Location of nginx configuration files may vary depending on your configuration. Please refer to nginx documentation if different from above paths. Of course one may increase or decrease the upload size limit from 20M to best suit own needs and preferences. 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi everybody,

I also have the same problem, I developed my website locally and the uploading pictures part worked just fine. After a certain period of time when I wanted to add a new child of the page and upload image it won't work. It shows nothing. BUT when I edit the pages that I have already created locally before submitting to the server, it works just FINE!, at work my boss wants me to add more items, but I can't do it since the image upload is not working. I saw the error in Chrome Dev tools. It says 404 Not Found, basically the image is not found, but when I enter the file with FileZilla the image is there.

Any help is greatly appreciated. Thanks in advance!

 

not-found-404.JPG

upload image.JPG

Link to comment
Share on other sites

  • 1 year later...

Is there something about the way that ProcessWire handles uploads that is different from other systems?

It seems I am often using some obscure PHP setting workaround (`always_populate_raw_post_data=-1`) or changing something at the server level. I hate wordpress, but I've never needed to perform any server admin to get their uploads to work–vagrant box or otherwise–does anyone know the reason ProcessWire is finicky here?

Link to comment
Share on other sites

With the previous question out of the way, I am also having the same issue. I'm still trying to debug this, but for some reason, the network response to https://example.com/admin/access/users/edit/?&id=1266&InputfieldFileAjax=1 is a 404 with the HTML of my homepage.

Link to comment
Share on other sites

19 hours ago, szabesz said:

 

I didn't realize the `always_populate_raw_post_data` option was for 5.6. The server that's bricking uploads is on 7.0.29.

 

Symptoms:

  1. Uploads show the progress bar, and then the spinner shows up. It never goes away. Checking the page's directory in `/site/assets/files/{id}` shows that the file has uploaded, and isn't corrupted. ProcessWire isn't recognizing this because the response from the AJAX is the content of the site's homepage. I have disabled modules to no effect.
  2. It seems that the uploader is specifically having trouble with JPGs.

Debugging Info (from TracyDebugger thank you @adrian) :

ProcessWire: 3.0.123
PHP: 7.0.29
Webserver: Apache
MySQL: 5.6.41-84.1

allow_url_fopen: 1
max_execution_time: 600 (changeable)
max_input_nesting_level: 64
max_input_time: 600
max_input_vars: 1000
memory_limit: 512M
post_max_size: 30M
upload_max_filesize: 30M
xdebug:
xdebug.max_nesting_level:

mod_rewrite: 1
mod_security:

GD: bundled (2.1.0 compatible)
GIF: 1
JPG: 1
PNG: 1

EXIF Support: 1
FreeType: 1
Imagick Extension: 1

BatchChildEditor: 1.8.10
ConnectPageFields: 0.1.8
EncryptDecryptRc4: 1.0.0
HtmlBodyClasses: 1.0.0
ImportPagesCSV: 1.0.6
InputfieldSimpleMDE: 1.0.5
Migrations: 0.3.1
PageCleanEmptyDirs: 0.0.3
PageRenameOptions: 1.0.5
ProcessChildrenCsvExport: 1.7.0
ProcessDatabaseBackups: 0.0.4
ProcessDirectoryMemberTools: 1.1.1
ProcessMigrations: 0.1.3
ProcessWireUpgrade: 0.0.7
ProcessWireUpgradeCheck: 0.0.7
TemplateCacheOverview: 0.0.3
TracyDebugger: 4.10.19
VirtualParents: 0.0.1
WireMailSmtp: 0.3.0

Things I've tried:

  1. Upload a JPG. Spinner. Open that same JPG in Photoshop, save it as a PNG (tripling its filesize) and upload. Upload takes, PW recognizes it. Save page. Resave the PNG as a JPG, upload that. Uploader spins. Check directory in FTP, all the files are there.
    image-upload-response.thumb.jpg.d0edde0a4b09f53d84480166c459e52e.jpg
  2. Changed the field to use server-side resizing, no effect.
  3. Changed the max megapixels from NULL to 12.0, no effect.
  4. Resize the original JPG to ~1000px, upload it, and it works. o_0

---

Not sure what to do now. It seems similar to @Batyr's problem, in terms of the POST returning a 404. This does not happen on my local box with the same codebase.

Does anyone have any ideas?

 

EDIT:

The weirdest part is that this just started happening on this server. I don't know the exact date or time, as the client just informed me the image uploads were struggling.

Link to comment
Share on other sites

Typically you want to click on the ajax called file that is uploading - Then on the response tab - that should show you any errors that are corrupting the uploading.

Also, just an FYI that your version of Tracy is a year old 🙂

  • Like 1
Link to comment
Share on other sites

haha @adrian, I have updated TracyDebugger to the most recent!

I am confused by your response because the screenshot I posted was of the Browser Tools Network tab - the "404 ... POST" you see is the JPG upload attempt. Here are more screenshots, with the request details panel open. I am not seeing any errors in the response: just the HTML for the site's homepage.

When a JPG is uploaded:

03.thumb.png.2a518af28ceae6c7ca4636d7697a702d.png

03.5.thumb.png.84cc30f955d74e4e3f2b36102843998a.png

04.thumb.png.732c555fc89cecc43a7853432ec4d476.png

 

When a PNG is uploaded:
(and this is the same page, with no reload in between attempting these two uploads)

3_01.thumb.png.ea0bbd5e3d6fa9f4552e25c2f9aebd10.png

3_02.thumb.png.c54f7091ade74335baf7fae8c2a8ed83.png

3_03.thumb.png.cb6578163a856b7ebaafef99df02223e.png

 

Request 1 and 3 are the JPG and PNG upload, respectively.

Link to comment
Share on other sites

The more I look at this, the more it seems like it's an .htaccess issue. Some uploads work, some don't. I've just noticed that some Page Edit links resolve to the same 404 page, so this seems less like an image upload problem, and more like a routing problem. But as for the reason, I am completely stumped.

Link to comment
Share on other sites

1 minute ago, matjazp said:

Strange indeed. <div id="pageID...></div> is your page404 markup?

That's just what is rendered in an AJAX call to the homepage:

_main.php

<?php
// include page structure if not an ajax request
if(!$config->ajax):

    include("./_head.php");

?>
<div id="page">
    <div class="content-container clearfix">
        <div class="content current-content">
        <?php endif; // endif ajax ?>
         
        <?php // if ajax then only return $content
            echo $content;
        ?>

        <div id="pageID" data-pageID="<?php echo $page->id; ?>" class="d-none"></div>
         
        <?php if(!$config->ajax): ?>
        </div>
    </div>
</div>
<?php

    include("./_foot.php");

endif; // endif ajax ?>

 

Link to comment
Share on other sites

On 4/9/2019 at 3:36 AM, ethanbeyer said:

the network response to https://example.com/admin/access/users/edit/?&id=1266&InputfieldFileAjax=1 is a 404 with the HTML of my homepage.

I don't think this has anything to do with the home page specifically - it's the 404 page, which gets markup from _main.php because I expect that file is auto-appended to the template.

My suspicion is that some security policy on your server is interfering to block the normal PW behaviour, and the 404 is a side-effect. It looks like ModSecurity is not enabled though so perhaps something else. You could ask your hosting provider to check.

Are you using ImageSizerEngineImagick by any chance? Does the issue resolve if you uninstall that to use the GD default?

Link to comment
Share on other sites

19 minutes ago, Robin S said:

Are you using ImageSizerEngineImagick by any chance? Does the issue resolve if you uninstall that to use the GD default?

@Robin S Holy macaroni. That was it. I thought I had tried everything. Where...where do I paypal you some beer money? Seriously. DM me if that's possible. I owe you big time.

  • Like 1
Link to comment
Share on other sites

@ethanbeyer, no worries, just glad to help. 🙂

It would be good to get to the bottom of what is causing ImageMagick to suddenly fail though. @netcarver linked to this article recently in another topic: https://alexvanderbist.com/posts/2018/fixing-imagick-error-unauthorized
It deals with a new security policy relating to PDF conversion but I wonder if some other policy has been introduced that affects JPGs too. If so there might need to be a fix applied to ImageSizerEngineImagick. Maybe your host could shed some light on what policy is being triggered by your uploads? Or maybe @horst has heard something about an ImageMagick update that might be connected?

  • Thanks 1
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Liam88
      Hi,
      I'm really struggling with this as it's something not in my wheelhouse. I'm creating a blog style page (a grid of cards) which has attributes.
      I have a snip of javascript which grabs values from checkboxes which are put into a value like the below:
      ?content=static_video&channel=facebook-ads_instagram-ads
      document.querySelector("form").onsubmit=ev=>{ ev.preventDefault(); let o={}; ev.target.querySelectorAll("[name]:checked").forEach(el=>{ (o[el.name]=o[el.name]||[]).push(el.value)}) console.log(location.pathname+"?"+ Object.entries(o).map(([v,f])=> v+"="+f.join("_")).join("&") ); document.location.href = location.pathname+"?"+ Object.entries(o).map(([v,f])=> v+"="+f.join("_")).join("&"); } As I'm currently refeshing the page on button click with those values the end result includes the location but can easily remove this.
      I then use this value in "input->get" to get the values which I then append to a find() rule. See code below:
      $selector = "template='adbank_pages',sort=published,include=all,status!=hidden"; // Get the channel and content inputs $channel = $input->get->channel; $content = $input->get->content; if($channel){ // Grab the channel string, explode into an array for checkbox checking and then replace _ with | to create or rules in the selector. $chanArray = explode("_", $channel); $chan = $channel = str_replace('_', '|', $channel); $selector = $selector .= ",ab_channels=$chan"; } if($content){ // Grab the content string, explode into an array for checkbox checking and then replace _ with | to create or rules in the selector. $contArray = explode("_", $content); $cont = $content = str_replace('_', '|', $content); $selector = $selector .= ",ab_content=$cont"; } if($input->get){ // If a valid input result $all = $pages->find($selector); } }else{ // If no input show them all $all = $page->children("template='adbank_pages',sort=-published,include=all,status!=hidden"); } $items = $all->find("limit=12"); // Limit the output and use pagination As mentioned above I currently refresh the page to adjust the $selector filter within the $all with a fallback $all if there are no results.
      I know I need to use AJAX to filter the content without refresh but I am really struggling with the set up. I have read multiple posts including the original by Ryan but still confused.
      If anyone can direct/help on this it would be appreciated.
      Thank you
    • By Max Esnée
      Hi,
      When I upload a large(ish) SVG (≈120ko in this case) into an image field, it tends to get stuck at 100% and block the whole website. If I force refresh the admin page, the svg has not been uploaded. The file is correctly copied into the assets folder though. Other svg tends to be uploaded fine albeit I've noticed that pages containing svg images in the admin are very slow to load generally. Other pages using the same template but with jpeg or png images are much faster to load.
      I get the following error in the JS console:

      I develop locally using MAMP on macOS and I'm using Firefox. I'm using the last ProcessWire version (3.0.165).
      I also tested in Chrome and got the same error.
    • By Marvin
      Hello,
      I'm new at process wire and i want to make an web using upload file and showing it at the table as a link to open it at the new tab. I wa succed while upload a file, but how i showing it as a link at the table to open it at the new tab of my browser? Any suggestion may helpfull
      Here i attach my code below :
      This code is for upload it to back-end (process wire)
      <?php $note = $note2 = $hidden =""; if($input->post->submit){ $upload_path = $config->paths->assets.'files/upload/'; if(!is_dir($upload_path)){ if(!wireMkdir($upload_path)) throw new WireException("No upload path"); } $original = $sanitizer->text($input->post->original); $indonesia = $sanitizer->text($input->post->indonesia); $other = $sanitizer->text($input->post->other); $composer = $sanitizer->text($input->post->composer); if(!$original || !$indonesia || !$other || !$composer){ $note = "Data tidak lengkap"; } else { $newFile = new WireUpload("song_files"); $newFile->setMaxFiles(1); $newFile->setOverwrite(false); $newFile->setDestinationPath($upload_path); $newFile->setValidExtensions(array('pdf','docx','doc')); $files = $newFile->execute(); if(!count($files)) { $newFile->error("No files received, so not creating page."); return false; } $newImg = new WireUpload("img_files"); $newImg->setMaxFiles(1); $newImg->setOverwrite(false); $newImg->setDestinationPath($upload_path); $newImg->setValidExtensions(array('jpeg','jpg','png','gif')); $files = $newImg->execute(); if(!count($files)) { $newImg->error("No files received, so not creating page."); return false; } $newPage = new Page(); $newPage->template = "files"; $newPage->parent = $pages->get("/files/"); $newPage->title = $original; $newPage->text_1 = $indonesia; $newPage->text_2 = $other; $newPage->text_3 = $composer; $newPage->of(false); $newPage->save(); foreach($files as $filename) { $filepath = $upload_path . $filename; $newPage->files->add($filepath); $newPage->message("Add file : $filename"); unlink($filepath); } $newPage->save(); } } ?> and this code to showing it as a link at the table
      <table class="border"> <tr> <th>No.</th> <th>Original Song Title</th> <th>Indonesia Song Title</th> <th>Other Song Title</th> <th>Composer</th> <th>File (pdf)</th> </tr> <?php $num = 1; $song; foreach($pages->get("/files/")->children as $child) { //showing every child at files parent directory $page == $child; $song = $pages->get("/files/".$child->id."/")->files; //showing uploaded files at child directory echo $child->id; echo "<tr><td>".$num++.".</td><td>".$child->title."</td><td>".$child->text_1."</td><td>".$child->text_2."</td><td>".$child->text_3."</td><td><a href='".$song->httpUrl."'</a>".$song->name."</td></tr>"; } ?> </table> Thank you for any suggestion
    • By markus_blue_tomato
      We have created a module to create BlurHash strings for images while uploading in ProcessWire. This blurry images will be saved in the database because they are very small (20-30 characters) and can be used for Data-URL's  as placeholders for image-lazy loading.
      https://github.com/blue-tomato/ImageBlurhash
      E.g. where we use this in production:
      https://www.blue-tomato.com/en-INT/blue-world/ https://www.blue-tomato.com/en-INT/blue-world/products/girls-are-awesome/ https://www.blue-tomato.com/en-INT/buyers-guides/skateboard/skateboard-decks/ https://www.blue-tomato.com/en-INT/team/anna-gasser/
×
×
  • Create New...