DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: File Upload

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Mads Brunn
Changed:2005-11-24T00:42:12
Email:brunn@mail.dk

EXT: File Upload

Extension Key: fileupload

Copyright 2000-2002, , <brunn@mail.dk>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: File Upload 1

Introduction 1

What does it do? 1

Screenshots 1

Users manual 1

Configuration 2

Reference 2

Known problems 2

Introduction

What does it do?

- File Upload displays an upload form giving front end users the possibility of uploading files to the server. It checks for allowable mime types and extensions.

Screenshots

img-1

Users manual

Installation is simple. Just install the extension from the repository and insert the plugin on the page where you want the upload form.

Configuration

Reference

checkMime

Property

checkMime

Data type

boolean

Description

If set, the plugin will check for allowable mime types

Default

0

mimeInclude

Property

mimeInclude

Data type

[list of mime types]

Description

A comma separated list of allowable mime types. I the list contains a '*', all mime types will be allowed.

Default

mimeExclude

Property

mimeExclude

Data type

[list of mime types]

Description

A comma separated list of mime types that are not allowed. This list will override the mimeInclude list.

Default

checkExt

Property

checkExt

Data type

boolean

Description

If set, the plugin will check for allowable file extensions

Default

1

extExclude

Property

extExclude

Data type

[list of extensions]

Description

A comma separated list of allowable mime types

Default

ExtInclude

Property

ExtInclude

Data type

[list of extensions]

Description

A comma separated list of file extensions that are not allowed. This list will override the extInclude list.

Default

maxsize

Property

maxsize

Data type

Integer (bytes)

Description

The max allowable size of upload files.

Default

50000

path

Property

path

Data type

string / stdWrap

Description

The path on the server where uploaded files should be stored.

Default

fileadmin/

noOverwrite

Property

noOverwrite

Data type

boolean

Description

If set, overwrite is not allowed.

Default

1

FEuserHomePath

Property

FEuserHomePath

Data type

Boolean

Description

If set and a frontend user is logged in, the uid of the frontend user will be appended to 'path' (see above). The upload path of the user with uid 3 would e.g. be ”fileadmin/3/”. If the users folder doesn't exist it will be created.

Property:

.field = field in the fe_user table to use as foldername instead of the uid (e.g. username)

Example:

plugin.tx_fileupload_pi1.FEuserHomePath=1
plugin.tx_fileupload_pi1.FEuserHomePath.field=username

Default

0

fileMode

Property

fileMode

Data type

string

Description

The file mode of uploaded files (applies only to unix filesystems)

Default

0755

uploadformcObject

Property

uploadformcObject

Data type

cObject

Description

This is a TypoScript object that must generate the html for your upload form!

The upload form must contain the following:

  1. an input field of type "file" and name "tx_fileupload_pi1"

b) an input field of type "submit" and name "tx_fileupload_pi1[do_upload]"

the FORM-tag should have its enctype attribute set to "multipart/form- data"

Note: The marker ###STATUS### will be replaced with any status messages that was generated following an upload (se below).

Example:

uploadformcObject = TEXT

uploadformcObject.value(

###STATUS###

<form enctype="multipart/form-data" method="POST">

<input type="hidden" name="MAX_FILE_SIZE" value="500000">

<input name="tx_fileupload_pi1" type="file"><br>

<input type="submit" name="tx_fileupload_pi1[do_upload]" value="Upload!">

</form>

)

Default

message

Property

message

Data type

cObject array

Description

This is an array of cObjects containing the status messages that can be generated following an upload. The possible keys are:

message.exist (displayed if the file already exists on server)

message.toobig (displayed if the uploaded file is too big)

message.mimenotallowed (displayed if the files mimetype is not allowed)

message.extensionnotallowed (displayed if the files extension is not allowed)

message.uploadsuccesfull (displayed if the upload was succesfull)

message.partial (displayed if the file was only partially uploaded)

message.nofile (displayed if there was no file to upload)

message.unknown (displayed if an unknow error occured)

Note:

The status messages will only be displayed if .uploadformcObject contains the marker ###STATUS### (see above)

Default

((generated))
Example
plugin.tx_fileupload_pi1.checkMime = 0
plugin.tx_fileupload_pi1.mimeInclude = image/gif,image/jpeg,application/x-zip-compressed
plugin.tx_fileupload_pi1.mimeExclude = application/octet-stream
plugin.tx_fileupload_pi1.checkExt = 1
plugin.tx_fileupload_pi1.extExclude = exe,php,php3
plugin.tx_fileupload_pi1.extInclude = *
plugin.tx_fileupload_pi1.FEuserHomePath=0
plugin.tx_fileupload_pi1.maxsize = 50000
plugin.tx_fileupload_pi1.path = fileadmin/
plugin.tx_fileupload_pi1.noOverwrite = 1
plugin.tx_fileupload_pi1.fileMode = 0755

plugin.tx_fileupload_pi1.uploadformcObject = TEXT
plugin.tx_fileupload_pi1.uploadformcObject.value(

  ###STATUS###
  <form enctype="multipart/form-data" method="POST">
  <input type="hidden" name="MAX_FILE_SIZE" value="500000">
  <input name="tx_fileupload_pi1" type="file"><br>
  <input type="submit" name="tx_fileupload_pi1[do_upload]" value="Upload!">
  </form>
)

plugin.tx_fileupload_pi1.message{

 #File already exists on server
 exist = TEXT
 exist.value = <p>Upload failed! The file already exists.</p>

 #File too big
 toobig = TEXT
 toobig.value = <p>Upload failed! The file is too big.</p>


 #Mime type not allowed
 mimenotallowed = TEXT
 mimenotallowed.value = <p>Upload failed! This mime type is not allowed.</p>


 #File extension not allowed
 extensionnotallowed = TEXT
 extensionnotallowed.value = <p>Upload failed! This file extension is not allowed.</p>


 #Upload was succesfull
 uploadsuccesfull = TEXT
 uploadsuccesfull.value = <p>File was succesfully uploaded!</p>


 #File was only partially uploaded
 partial = TEXT
 partial.value = <p>Upload failed! The file was only partially uploaded.</p>


 #No file was uploaded
 nofile = TEXT
 nofile.value = <p>Upload failed! File not found.</p>


 #Unknown error
 unknown = TEXT
 unknown.value = <p>Upload failed! Error unknown.</p>

}

Known problems

If you type in a name of a file (without specifying a path) that doesn't exist on the client, an empty file with that name will be created on the server. Don't know how to solve this (The backend's fileadmin has the same problem).

Changelog

0.2.0 Added userHomePath feature

0.3.0 Added German translationAdded property .field to FEuserHomePath

For more information you can go to typo3.org .

img-2 EXT: File Upload - 4