JoeGandy / ShareX-Custom-Upload

A little PHP script created for uploading custom sharex files to your own webserver
MIT License
166 stars 50 forks source link

Error: "You may not upload with the key parameter" #49

Closed k4lim closed 5 years ago

k4lim commented 5 years ago

I just set everything up but somehow my secret key won't get accepted. I tried test as secure_key but when I test the shareX config, I get the You may not upload with the key parameter error.

My config file:



return [
    /* This is a secure key that only you should know, an added layer of security for the image upload */
    'secure_key' => 'test',

    /* This is the url your output will be, usually http://www.domain.com/u/, also going to this url will be the gallery page */
    'output_url' => 'https://sharex.domain.me/u/',

    /* This request url, so the path pointing to the uplaod.php file */
    'request_url' => 'https://sharex.domain.me/upload.php',

    /* This is a redirect url if the script is accessed directly */
    'redirect_url' => 'https://domain.me/',

    /* This is a list of IPs that can access the gallery page (Leave empty for universal access) */
    'allowed_ips' => [],

    /* Page title of the gallery page */
    'page_title' => 'ShareX Gallery',

    /* Heading text at the top of the gallery page */
    'heading_text' => 'Uploading Site',

    /* Delete file option (true to enable, disabled by default) */
    'enable_delete' => false,

    /* Show image in tooltip  (true to enable, disabled by default) */
    'enable_tooltip' => false,

    /* Show link to download all files as .zip (Untested with large archives of files) */
    'enable_zip_dump' => false,

    /* Generate random name (true to enable, disabled by default) */
    'enable_random_name' => true,

    /* Select lenght of random name (10 symbols by default) */
    'random_name_length' => 10,
];
JoeGandy commented 5 years ago

Can you ensure your shareX side of the config is correct, use the auto downloader available from, https://sharex.domain.me/u/

Ensure you use the test options within shareX first

k4lim commented 5 years ago

Yes, I used the generated-config in ShareX. Using the test button in shareX gives me the same error.

sharex_settingsPNG

JoeGandy commented 5 years ago

Very odd, seems like your post data isn't hitting the site, but it looks set fine in your config.

I suppose you could try trigger a manual request with post man with the key and see if you get a response.

Make sure your webserver isn't redirecting around in a way that would remove post data too?

k4lim commented 5 years ago

I just tried if my nginx configuration is handling GET/POST at all and it seems like it works just fine.

test.php : <?php print_r($_GET); ?>

Call: https://www.sharex.domain.me/test.php?key=test

Response: Array ( [key] => test )

If I try to call the shareX script directly however, I get the same error as above: https://www.sharex.domain.me/upload.php?key=test

Could it have something to do with #47?

justinlevinedotme commented 5 years ago

I'm having the same issue over here. Tried it all.

JoeGandy commented 5 years ago

Very odd, @freejstnalxndr Are you also going through https + nginx?

justinlevinedotme commented 5 years ago

@JoeGandy https + apache. I tried getting rid of my cert and uploading it through http. Still no luck.

I ended up using https://github.com/Inteliboi/ShareX-Custom-Upload and it worked fine. Maybe it has something to do with the upload.php? I am sure you could probably modify it to work with this, but then again I'm not amazing with PHP , so you would know better whether it'd work or not.

Thanks for your fast response.

JoeGandy commented 5 years ago

Okay yeah its definitely a change I made recently causing the issue. Will keep looking into it, glad you've found something that worked

JoeGandy commented 5 years ago

@DJkikisa @Natfan

Are either of you two able to reproduce?

JoeGandy commented 5 years ago

Hi I've just confirmed functionality is working,

I have a site set up with https, using the u/ custom directory I have a 301 redirect from http version of the site to https

I download the config generated by the web ui

Test an image upload which works. If yo have anymore details on how to reproduce let me know.