Bad Request - Invalid URL with PDFs (v2024)

I am using phpmaker 2024 and am running into an odd error. I have a file upload field that uploads just fine, preview is good, and the files are uploading properly.

the only problem is that if I upload a pdf it shows up in the edit form, but when I go to the view page I am getting a 400 error

If I upload a doc file or an image file it’s fine.

How can I fix this?

Since I am new to this forum I can only upload one photo per post so I wanted to add that when I go to the edit page the link to the pdf is OK

Press F12 in your browser, go to the Network panel. Browse to the problem View page, check the HTTP request for the PDF in the Network panel, examinie the HTTP response to find the error. Check the URL. Also see Check HTTP Response for detail, follow the steps.

So for some reason whenever I open the network panel with F12 the link appears. Close the panel, refresh, and I get the 400 error again. I should also note this is on a localhost environment
Network panel closed

Open Network panel (and click refresh)
image

a quick look at the Console reveals this
image

I am using Chrome. When using FireFox (Dev ed) it doesn’t even show the 400 error, but I do get an error in the Network Console NS_ERROR_WONT_HANDLE_CONTENT. I googled this but didn’t see anything relevant (to me at least)

PS sorry for the multiple posts, I am prevented from uploading more than one image at a time_

Your browser does support PDFObject, as shown in the screenshot of your second post above. Also double check your web server config and make sure it serves .pdf files.

I am using Chrome (Ver. 139) so I don’t know how it couldn’t. And it didn’t work in the latest Firefox either.

my localhost IIS does have pdf as a mime type .

image

Could having Adobe Acrobat Pro as an extension possibly be causing an issue?

It is possible, you may test by disabling it or test with another browser without the extension enabled.

I can confirm that it’s not Adobe. I disabled it and the problem still exists. I uploaded to a production server and the issue is still there plus this also happens with other docs but not images. What’s interesting is that it only happens on the View page, the edit page is fine.

do I need to add a link in the href? e.g.

I have never had to before

one more thing to add - why is the link not just the link to the file in the dir it was put? e.g.

<div class="ew-pdfobject" data-url="/cms/api/file/scholarships/eyJpdiI6IjlzTHNZUnJiWGlLQWZDRi9JUHhYUVE9PSIsInZhbHVlIjoiQVFhMWk0T3Y0aGZleUZ1MDIwN25POFRvK255RDdmM1B3c1Q4azN2MEdzMjZ0OGhDU05xMnZCOGFiM3lFNnBRSTk4TVFGNmY5VUpWTFBlTDFndmlVU2RmNnlkVVBtRko3UnBYZ2sxQU5IV0tPc3FIaGFWUTh1bjU5bXIzT2tDd2wiLCJtYWMiOiI1NGU1NTUzMzUyMTdmYmNkYjk3NmQ5MWM1MWU1MDMxMzM4MDQzYThlZmE0MDFlN2I3MDZhNWYzYzYyNjQ3OTc3IiwidGFnIjoiIn0=?session=eyJpdiI6IjllNWE4cEJCZ3lKbzZBVTRleno2cXc9PSIsInZhbHVlIjoid0UwczlTc01oOHBVVDFLai9rTmtPaFBFR0ora2t0T3Q5a1dhZEhyTDhvYz0iLCJtYWMiOiI1NmM0YTdjZjFmMmEwZjJmZmJmODRlYjhhMzhhOTcyYzgyZTFiNzc5MDliNGZkN2FhM2I2ZWVhYTZmOTNiMmE0IiwidGFnIjoiIn0=&csrf_name=csrf689f781c1d95d&csrf_value=TOm82ifyCT9v74XkcBUsqRg8s6QpEnJZwkgrwz6U26Upi4ntRcJqBg3f4IATcBrLIAmDxxpzRW31eR/2W/HonQ=="><a>Cannondale CAAD9 6 - Montgomery Cyclery.pdf</a></div></span>

I am getting GET http://localhost/cms/api/file/scholarships/eyJpdiI6ImxuYXJMNHhlaDh5QzNyenpaV1Jmemc9PSIsInZhbHVlIjoidlhEQnNYTlNyOS9tc1B4YjNHK0E0SmhBUzY4dVQyWndqWFNQR2k4SGlwSVZRRm5mTmJlclFDdDA3K2QweUg5NzZHZlBDUnNVTktJU2FHc3BVSlpSbXRBaXdlTGpCVDFUUEg1bW5FT3BOUUVSUUVZZUUvazUyZExtL3RDbUdOR0IiLCJtYWMiOiI5ZDUyZDljNGM0OTE0ZGNkZWNjOWFmZjY0MTc3ZGE5MThlNzkxMjU3ZWY3MzViNmJkMjg3ZGQ0ZDcyN2Y3OGM0IiwidGFnIjoiIn0=?session=eyJpdiI6IkdNNmhDQlZTWDhZY0FiMHNod0ZiYUE9PSIsInZhbHVlIjoiR0lCTS9qSWxqMVRpYy9qWFkwZU9WTkVXbUZEVWhYQjk0Mk82ZDJYRGhBUT0iLCJtYWMiOiI5ZTM3ZTNkNjQwNzQ2ODI5YjY5MzdiNDkyODMwMzQ3ZjNiZWMwMDRkYjc2ZWFlOWQ5MGUyNDc0ZGIzZDc5YTEwIiwidGFnIjoiIn0=&csrf_name=csrf689f79c46b7aa&csrf_value=84yihuJLXB2cRb6ZRGoIXOhWGHAWnpIvfofBJgCdqQOX6pWw13hqe/4mivonXzFojDR5RCKp8RYf4vVAZqmRZw== 400 (Bad Request) in the console

Seems to me that this is the issue

It is possible that the URL is too long for your web server, you may try configure web server to accept longer URL.

Thanks, but that didn’t do it. I upped both the Max URL and Max querystring to 9064 (almost 4x the default values) and I am still getting the 400 error.

Is it possible that this is not an issue in PHPMaker 2025? I am using 2024…

  1. So you are using IIS, check the web.config of your site (if exists) or that of the parent site (if exists) and make sure you have valid setting, e.g. <httpRuntime maxQueryStringLength="8192" maxUrlLength="16384" />.
  2. Yes, you should upgrade and try v2025. v2024 is out-dated.

I do not have that in my web.config. it’s pretty basic at this point. I tried putting it under <system.webServer> and it crashed the site.

I downloaded 2025 and opened my project then generated the code. Two things are happening - 1) my footer didn’t change it’s still using the custom footer from the original project. (normally the trial versions don’t allow that)
2) Now I am getting an error when uploading the images,

I gave IUSR full access to the output folder so I am not sure what else to do

As the error message told you, you don’t have write permission, you need to grant write permissions to the folder for the web server user, simply google “IIS write permission”.

I know how to grant write permission to the IUSR but even when I do give full access to the /cms/ folder AND the folder I want the files to go to I am still getting that error. Interestingly whenever I try doing this I get a permission error saying that there was an error applying permissions to the logs folder. e.g.

image

You may delete the “cache” folder and then grant permissions to the “log” folder.

You may also want to stop IIS when you change read/write permissions and then restart IIS.

If IIS does not work well for you, you may try WampServer. (But you need to learn the basics of Apache, and you still need to grant write permissions yourself.)

Still having the issue.

Shut off IIS.
deleted any file/folder that permissions couldn’t be changed
added IUSR full access to the CMS folder successfully
turned IIS back on
tried to upload, got the same error - couldn’t write files to disk.

Using another webserver is not an option.