ePages 7.25.0 - DE_EPAGES/Presentation/API/Upload.pm

Package DE_EPAGES::Presentation::API::Upload

upload files (saveFile, UploadToMediaGallery, UploadFiles, SaveFiles, savePrivateFile, ImportStyles, SaveStylePreview, Save, SaveDownloadProductMaps, CVSImport)

@EXPORT_OK
Upload
GetJSONImagesInfo
GetJSONImageInfo

Functions

GetJSONImageInfo
GetJSONImagesInfo
Upload

GetJSONImageInfo

Unifies the data returned by JSON upload UI action handler. Returns a hash ref with the two keys 'imageInfo' with data from GetImageInfo() and 'uploadedObjectFile' with data of the uploaded file.

Syntax
$hJsonImageData = GetJSONImageInfo( $PublicPath, $File );
my $hJsonImageData = GetJSONImageInfo($PublicPath, $File);
$hResponseContent->{$_} = $hJsonImageData->{$_} foreach keys %$hJsonImageData;
Input
$PublicPath (string)
public path of the object
$File (string)
full file system filename of the uploaded file
Return
$hJsonImageData (ref.hash)
info data for the given files
  • imageInfo | image info for the file. See GetImageInfo() for details
    | ref.hash
  • uploadedObjectFile | relative path of the file | string

GetJSONImagesInfo

Unifies the data returned by JSON upload UI action handler. Returns a hash ref with the two keys 'imageInfo' with data from GetImageInfo() and 'uploadedObjectFiles' with data of the uploaded files.

Syntax
$hJsonImageData = GetJSONImagesInfo( $PublicPath, $aFiles );
my $hJsonImageData = GetJSONImagesInfo($PublicPath, \@Files);
$hResponseContent->{$_} = $hJsonImageData->{$_} foreach keys %$hJsonImageData;
Input
$PublicPath (string)
public path of the object
$aFiles (ref.array.string)
full file system filename of the uploaded files
Return
$hJsonImageData (ref.hash)
info data for the given files
  • imageInfo | image info for each file. See GetImageInfo() for details
    | ref.array.hash
  • uploadedObjectFiles | relative path of each file | ref.array

Upload

Saves an uploaded file, multiple files, a URL on the server. Returns the file name with the file extension relative to object directory and the standard response for the servlet.

Syntax
my ($aFileName, $hResponse) = Upload( $Object, $Form, $hParam );
my ($aFileName, $hResponse) = Upload( $Shop, $Form, {
   'InputName' => 'NewFile', 'Index' => 0,
   'Extension' => 'zip', 'Binary' => 1,
   'CreateDirectory' => 1,
   'Path' => '/Webroot/Store/Shops/Demoshop/',
   'FileName' => 'BlaBla',
   'Formname' => 'NewFile',
});
Input
$ServletObject (object)
servlet object
$Form (object)
servlet form object
$hParam (ref.hash)
optional params
  • InputName | inputfield Name | string
  • FormName | form name to associate form errors with correct form | string
  • Index | index, which file in the inputfield | integer
  • Path | Where the file should be saved on the server | string
  • FileName | FileName on the server | string
  • Extension | Extension of the file on the server | string
  • Object | If the upload is associated with another object than
    $Servlet->object
  • Binary | binary option for the sub WriteFile() | integer
  • CreateDirectory | option for the sub WriteFile() | integer
Return
$aFileName (ref.array)
relative file names with file extension
$hResponse (ref.hash)
possible servlet response
  • uploadedFile | Webpath to the uploaded file | string
  • uploadedObjectFile | relative file name with file extension | string