File Upload Failed Chmod or Not Exist Sharex

ShareX-Custom-Upload

A little PHP script created for uploading text, files, and images to your own webserver. It supports uploading via ShareX, but also on the web interface, and with command line scripts.

Installation

Download the latest release as a ZIP from the Releases page.

Excerpt the ZIP and follow the setup instructions below.

If you'd like to run on the bleeding-edge of updates, clone this repo, and supervene upon all references to release in the documentation with src. Point your spider web server's document root to this src binder, and disable the motorcar-updater. To update, run git pull.

Migrating from Version 1

Version 2 introduced major breaking changes that go far incompatible with Version one installations. See the migration guide for instructions on how to upgrade your uploader.

NGINX Configuration

By default, this server relies on Apache's .htaccess configuration files to part. However, it is possible to configure NGINX to work with the uploader. Please read the NGINX configuration guide for more than data.

Setup

Note: this script requires the openssl and fileinfo extensions to exist enabled in your php.ini.

Annotation: If using Apache, y'all must also make sure that mod_rewrite and mod_authz_core are enabled in your httpd.conf.

  1. Enter the release folder
  2. Make a copy of the config.default.php file and salve it equally config.php
  3. Edit the config.php file as you encounter fit

For your site to first working, the only setting you need to modify is base_url. This volition be the URL where your gallery folio is attainable.

Then, upload the contents of the release folder to your website.

Come across the full configuration documentation for more than information near how to configure your installation.

Important: If you lot choose to non place your uploader in the root of your website, the base_url setting needs to include the path to where the uploader lawmaking will be accessible. If y'all practice this and you use Apache, you will also need to to change the RewriteBase in the .htaccess file to incude the path to your uploader.

For example, if you lot want your uploader to be located at https://mydomain.com/myfileuploads, you lot volition demand to upload the contents of the release directory to /website/root/directory/myfileuploads, set base_url to https://mydomain.com/myfileuploads and update the RewriteBase line to say RewriteBase /myfileuploads

Updating

Updating to a new version is fully automated, except pressing a push. When a new update is bachelor, a big banner will appear that prompts you to update. Confirm the update, and it'll do the remainder for you lot.

Of import: The automatic updater does not modify any of your configuration files, and then if the configuration format is modified in the future, you volition need to manually edit your configuration file to friction match the new format. Delight read the release notes for whatever new versions and bank check for any breaking configuration changes. You lot can always cheque the latest configuration file for an example of what your configuration should wait like.

If the update banner does not show up, please make sure that the VERSION file exists in both your uploader install directory and the release directory. The version number in the release directory must besides be college than the version number in your electric current installation.

If y'all get an mistake later on pressing the update button, make sure that the binder where your uploader is installed is writable. If that is the example and you still become an mistake, please open up an issue.

Note: The uploader only supports automatic updating starting with version 2.i.0. If yous are currently using a version older than ii.1.0 and want to update, you lot will need to complete the update manually past copying the new files into your website. Withal, after you manually update, y'all will be able to use the automatic updater for future versions.

Login Configuration

This application supports login using a username and password. If you would like to enable this, set up the enable_password_login option in your config.php to true. At present, the next time you lot open your gallery page, y'all will exist prompted to register an account. But 1 account is allowed per installation. It is recommended that you prepare your account soon later enabling this setting, since anyone who attempts to view the gallery earlier an account is ready will be prompted to annals.

By default, the website will prompt you for a username and countersign to log in, but if you would like to just use a password, gear up the enable_username config selection to imitation.

If yous have forgotten your password or would similar to modify it, just delete the login.json file in your website's root directory. Exercise not edit this file straight, since your passwords and authentication tokens are hashed and changing them will corrupt the file.

ShareX Configuration

To start using your uploader with ShareX, get to your gallery folio (which volition be at the base_url you set in your configuration file) and click on the Share icon at the bottom of the page. This should automatically generate and download a ShareX configuration file. You tin can now open up the file and ShareX should prompt to add your uploader.

ShareX File Name Templates

The uploader supports using names generated by ShareX's templating system, which allows you lot to utilize data almost this image to generate your file name. To enable this, you lot will need to set the sharex_upload_naming_scheme to provided in your config.php.

To customize the format of this name after adding your uploader to ShareX, yous volition need to open up the Custom uploader settings from the Destinations carte du jour in the ShareX application. Select the name of your uploader in the Uploaders bill of fare. Now, you can edit the value of the name field Body table on the right.

This proper name field accepts whatever valid ShareX name template as a value. Yous can create a ShareX template string by opening the Job Settings card from the ShareX application, opening the File naming tab, and selecting the Proper noun pattern for capture or clipboard upload field. A dropdown will open on the correct, which y'all can use to create the template cord you desire to use. You tin then copy the string from this field dorsum into the name field from the Custom uploader settings.

Transmission Setup

Alternatively, if yous have trouble with the higher up, you tin can manually add your uploader to ShareX.

  1. From the ShareX main application, go to Destinations and click on Custom uploader settings
  2. In the summit left corner, press New to add a new uploader profile
  3. Now, ready the Asking Method to Postal service
  4. Prepare the URL to your base_url/upload.php. For example, if your gallery is at https://example.com, set URL to https://example.com/upload.php
  5. Set File course proper name to fileupload
  6. Prepare Body to Course data (multipart/form-data) and in the table underneath, blazon in key for the name and ready the value to the secure_key set from your config.php file.
  7. Gear up the Proper name field at the superlative to something you can use to identify your uploader and in the lesser left, choose the profile y'all created for the Image, File, and Text uploaders.
  8. Close the window and in the destinations tab of the main ShareX window, choose the Custom uploader selection for the file types you lot would like to upload. (This awarding supports Paradigm, File, and Text uploading)

The setup is at present consummate, test your uploader and information technology should work!

Shell Configuration

This uploader too supports text uploading via shell script. To use this feature, click on the Last icon on the lesser of your gallery page and select your shell surround. This will download a crush script which volition exist able to upload piped inputs to your site. Adjacent, follow the steps for your shell surround.

Bash

Motility the downloaded script to /usr/bin/local.

Windows Control Prompt

Move the downloaded script to C:\Users\yourusername\scripts (replacing yourusername with your Windows user folder). Then, add that folder to your PATH.

To exercise this, blazon Environs Variables into Windows Search. Then, in the window that opens, click on the Environment Variables... button. Find the Path variable in the User variables section, select it, and printing Edit. Then press the New button and blazon the path to the folder where your script is located (C:\Users\yourusername\scripts). Press Ok to salve all your changes and restart the command prompt.

Powershell

Open your Powershell profile file (the path is stored in the $PROFILE variable) and copy the contents of the downloaded script to the end of your profile file. Salvage the profile and restart Powershell.

Usage

Now, y'all can pipe text to the upload command and it will return the URL of the uploaded file. You can optionally provide a filename to be used for the upload.

Examples:

              somecommand | upload myfile.txt                          

Straight Uploading

Desire to upload directly using Post requests? You're in luck! We've got some documentation.

Screenshots

Screenshot of gallery page

Screenshot of text viewer

Planned Features

View the tasks board here.

Total Configuration

Below is an explanation of all available configuration options.

base_url

You must change this.

This is the near important configuration option. You must set this in club for your site to work. This needs to be set to the location where your uploader site'southward files can be accessed.

Important: If you cull to not place your uploader in the root of your website, the base_url setting needs to include the path to where the uploader lawmaking will be attainable. If you do this, yous will also need to to change the RewriteBase in the .htaccess file to incude the path to your uploader.

For example, if your uploader site's files are located at /website/root/directory/myfileuploads, set base_url to https://mydomain.com/myfileuploads and update the RewriteBase line to say RewriteBase /myfileuploads

secure_key

You must modify this.

This sets the token used by ShareX to upload images and files. Since you lot don't need to memorize this, you should probably ready it to something actually long and random.

Important: The secure_key cannot comprise the $ character due to limitations of PHP.

Note: This is not the countersign you use to log in to the gallery.

Here's a random cord generator yous tin use.

file_storage_folder

Default Value: 'u/'

This sets the directory where your uploads are stored. You actually shouldn't have to change this. If y'all desire to modify the path where your files are accessible on the site, apply the upload_access_path config option instead.

Notwithstanding, if you modify this and y'all employ Apache, you must copy the .htaccess file from the u/ directory to your new binder. If you lot do not do this, people will be able to run capricious code on your computer. (This is very bad.)

upload_access_path

Default Value: '/'

The sets the path where y'all will be able to admission your uploads from your browser.

Examples:

If you set this to / and your base_url is https://www.case.com, a file called filename.ext would be accessible at https://www.case.com/filename.ext

If you fix this to myfiles/, a file chosen filename.ext would exist accessible at https://www.example.com/myfiles/filename.ext

Note: For security reasons, this cannot be the same as your file_storage_folder.

zip_storage_folder

Default Value: 'backups/'

This sets the binder where Zip backups will be stored.

allowed_ips

Default Value: ['127.0.0.1', '::one']

This sets the IP addresses that are immune to access the gallery page. Notwithstanding, this does not control who tin can admission your uploads—anyone with a direct link to an file can see information technology. By default, only clients on the aforementioned figurer equally the host can access the folio.

Exit this bare to disable IP blocking.

enable_password_login

Default Value: simulated

This sets whether to use the countersign organization to login to the gallery folio. Using this setting will not disable the allowed_ips setting and IP blocking—the two volition be used in conjunction.

After the first time you enable this, attempting to view the gallery folio will prompt you to create an account.

See the password login section above for more than details.

enable_username

Default Value: truthful

This sets whether or not y'all will exist prompted to provide a username when y'all log in. This setting has no outcome if enable_password_login is false. If this setting is disabled, you volition only be prompted for your password.

remember_me_expiration_days

Default Value: thirty

This controls how long Think Me tokens are valid for.

When you log in and check the "Call up Me" box, your browser will save a unique identifier and you will not be prompted to log in the side by side time y'all visit the uploader. Afterward the number of days specified in this configuration choice, this identifier volition invalidated and you volition need to log in once more.

Remember Me tokens will automatically deleted from your browser if you printing the Log Out button. This setting only controls how long you volition stay signed in for.

page_title

Default Value: 'My File Uploader'

This sets the title shown for the gallery page tab in your browser.

heading_text

Default Value: 'My File Uploader'

This sets the text shown in the header on the gallery page.

gallery_date_format

Default Value: 'MMMM Practise YYYY, HH:mm:ss'

This controls the date format used to brandish file upload dates in the table on the gallery page.

Come across the Moment.js format options for information about how to configure this choice.

enable_gallery_page_uploads

Default Value: true

This controls whether to enable the upload forms on the gallery page.

enable_delete_all

Default Value: false

This controls whether to enable the option to delete all uploads from the gallery folio.

enable_delete

Default Value: true

This controls whether to bear witness the option to delete private uploaded files on the gallery page.

enable_rename

Default Value: true

This controls whether to show the option to rename files from the gallery folio.

enable_tooltip

Default Value: true

This controls whether to show image previews in a tooltip when image links are hovered over on the gallery folio.

enable_zip_dump

Default Value: simulated

This controls whether to bear witness the option to download all uploads equally a ZIP archive. This is untested with large amounts of uploads.

Annotation: This option does not command whether yous will be able to download uploads as a Zilch using the bulk selector.

enable_rich_text_viewer

Default Value: true

This sets whether to show text files in the rich text viewer or send all files raw.

The rich text viewer has theme support, line numbers, and syntax highlighting.

sharex_upload_naming_scheme

Default Value: 'random'

This sets the file naming format to use for ShareX uploads.

Possible values are go on, provided, appointment and random.

Continue way volition keep the file name sent past ShareX.

Provided way will use the file name sent in the proper noun field by ShareX. See the ShareX Configuration section for more information virtually how to prepare this upwardly.

Date mode will generate a file proper name based on the date and fourth dimension of the upload using the format specified in upload_date_format.

Random mode will generate a random file proper name with the length specified in random_name_length.

gallery_upload_naming_scheme

Default Value: 'random'

This sets the file naming format to use for gallery uploads.

Possible values are go along, appointment and random.

Keep mode will keep the proper name of the uploaded file.

Engagement manner will generate a file name based on the date and time of the upload using the format specified in upload_date_format.

Random mode will generate a random file name with the length specified in random_name_length.

text_upload_default_naming_scheme

Default Value: 'random'

This sets the file naming format to use if no file proper noun is provided for a text upload.

Possible values are date and random.

Date mode will generate a file name based on the appointment and fourth dimension of the upload using the format specified in upload_date_format.

Random fashion will generate a random file name with the length specified in random_name_length.

random_name_length

Default Value: 6

This setting sets the length of the random names generated if random is called as the default_naming_scheme.

upload_date_format

Default Value: 'Y-thou-d_H.i.s'

This setting sets the format used to generate file names if date is set up every bit the default_naming_scheme.

See the PHP date function options for information about how to configure this option.

Since this option is used for file names, there is a express selection of characters which can be used. See the Wikipedia Filename article for information almost what characters can be used in this setting.

enable_updater

Default Value: true

This controls whether to enable uploader's built in updater.

If enabled, the uploader will prompt you lot to update when a new version is released and volition automatically download and install the update if y'all concur.

If yous disable this, you will need to manually re-create the code from the new release to update.

enable_update_rollback

Default Value: true

This controls whether the uploader should make backups of the old version of the code when performing an update.

If this is enabled, the update will copy the old versions of all modified files to the rollback binder. If y'all an update ever breaks your uploader, yous can just go to <base_url>/rollback/update.php to coil back the update.

enable_image_cache

Default Value: true

This controls whether the uploader should instruct the browser to cache the uploaded images.

This is enabled by default, but tin slightly hurt performance on low power systems.

debug_mode

Default Value: fake

This enables Debug Mode, which volition instruct the uploader to log and transport additional debug information.

At the moment, this will only enable sending the time it took to generate image hashes for caching.

GitHub

https://github.com/JoeGandy/ShareX-Custom-Upload

diazpongle.blogspot.com

Source: https://bestofphp.com/repo/JoeGandy-ShareX-Custom-Upload

0 Response to "File Upload Failed Chmod or Not Exist Sharex"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel