File upload
You can upload images and files to include them into your website.
To upload, use the Special:Upload page. You need the right to view the Special namespace and the right to upload.
Experimental feature: Special:Upload Big can upload very big files (tested up to 1 GB).
The form will you ask for the file, for the filename on the server and for a comment. For each file, also a page in the Image namespace is created.
If you do not specify the filename, the filename of the uploaded file will be used.
Once uploaded, you can inspect the image on the image page. The image page has a tool to crop the image.
How to link to a file:
- Use a internal link [[Image:animage.jpg]] to embed it as image or use it as direct link
- Use an internal link [[:Image:animage.jpg]] to link to the image page.
- Use an internal link with the pseudo namespace Media [[Media:animage.jpg]] to link directly to the file.
- Use an internal link with the pseudo namespace Download [[Download:animage.jpg]] to provide a download link which is not exposed and still works with hotlink-protection. However, it uses PHP resources.
- Use an internal link with pseudo namespace Imagelazy [[Imagelazy:animage.jpg]] to show the image only if the element is visible. On long lists with many images, this speeds up the rendering of the page. Imagelazy works only correctly with grid views created in relation, because it depends on table.js
You can define the width and the width and the height of an image: [[:Image:animage.jpg|160]] [[:Image:animage.jpg|160|90]]
Height and width are optional.
You can define the crop if the aspect ratio of the destination is not the same as the source. Possible values are tl, tc, tr, cl, cc, cr, bl, bc, br where t stands for top, c for center, b for bottom, l for left and r for right. You can also use numbers 11-99 or auto.
[[:Image:animage.jpg|160|90|tc]]
You can add an alt text for the image
[[:Image:animage.jpg|160|90||My favourite cat]]
[[:Image:animage.jpg||||My favourite cat unscaled]]
See samples on Scale Image
The upload size is limited by three variables (the lowest of all three):
- $swMaxFileSize (default 800000) defines the limit in the form (MAX_FILE_SIZE).
- The PHP.ini variable upload_max_filesize
- The PHP.ini variable post_max_size
In the Configuration file, you can define the filetypes that are downloaded and not shown in the browser
$swMediaFileTypeDownload = ".xls.docx"
The period at the end of the
You need also to add a .htaccess file if you have downloadble file with the content or if you want to prevent hotlinking
AddType application/download .xls
AddType application/download .docx
RewriteRule ^(.*)$ index.php?name=$1 [L,QSA]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yoursite.com [NC]
RewriteRule .(jpg|jpeg|png|gif|pdf|xls|docx)$ - [NC,F,L]
Note: There is no version control on files. Older files will be deleted.
Note: Currently, only .jpg files are recognized as images.
Note: There is no limitation on the filetype at this time.