Welcome, Guest
Username: Password: Remember me

TOPIC: Data Types - File Upload and Download?

Data Types - File Upload and Download? 28 Apr 2015 17:56 #12952

  • tiagovtg
  • tiagovtg's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
Hello,

I'm already at the end of the component construction.

Just one detail to be all right.

Part of file upload and download.


Let the difficulties and doubts, as shown in the attached image:

1) Rename file, not working because it's cutting the file extension.

2) I can not use the file view or in the site or in the admin.

3) and more importantly, not downloading the file?



Thank you again for take all doubts and help.
The administrator has disabled public write access.

Data Types - File Upload and Download? 29 Apr 2015 03:44 #12953

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
Hello tiagovtg
i will try to help but if you can provide some of the following detail we may be able to solve it quicker for you

1) Firstly have you checked the extension types you allow in the field properties?

1a) does it work as expected in the sand box?

1b) when you set the field properties
in the upload tab do you have anything in the rename file field]
Default is {ALIAS}.{MIMEXT} (if rename file field is left blank)

2) So if you try to use
{ALIAS}.{EXT} will give the original file extension
{ALIAS}.{MIMEXT} Will use the details found in the header

3) {ALIAS}.{Ext} it will not work
The file options must be enclosed in { } AND the selected options such as EXT must be in caps

4) is it a true file type??? or is its something rendered by some other process and saved / converted to a different file type
i have seen issues in the past where a pdf was rendered by something else and the then saved with a .pdf file extension (NOT a Cook issue)

5) So now what file extension / type are you trying to upload???

6) is the file actually uploaded to the front end directory somthing like below?
(yourjoomladirectory/components/com_yourcomponent/files/viewname_fieldname)

7) what are the directory permissions on above directories

(8.) have you changed the default upload directory for that field ? (in component config)

That will do to start providing its a standard unforked download
Last Edit: 29 Apr 2015 03:50 by BTB300.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Data Types - File Upload and Download? 29 Apr 2015 17:01 #12955

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Thank BTB,

This is a good step list to compile in the docs. I keep the page for later.
As always, I have noting to add after that.
Brillant.
K++
Coding is now a piece of cake
The administrator has disabled public write access.

Data Types - File Upload and Download? 30 Apr 2015 10:54 #12956

  • tiagovtg
  • tiagovtg's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
Moderator, thx.

1) I tested it and took pictures and actually in the sandbox is working, but when I install on my machine not.
The download could not see where I or in the sandbox or on the installed on my machine.
Here are pictures attached.

2) i set set field properties, to rename {BASE}.{EXT}

4) yes, is true file PDF.

5) The file extension is pdf.

6) The directory is joomadirectory/images/xxx, set in config.xml params

7) The permissions are full, 755 or 777

8) yes, i changed the default upload directory to, /images/xxx


sorry the delay in Reply.
The administrator has disabled public write access.

Data Types - File Upload and Download? 30 Apr 2015 12:24 #12957

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
Hi tiagovtg,
OK Firstly a word of Warning regarding Permissions of 777 full permissions
I hope you only use 777 permission in testing locally because of testing this upload issue
Otherwise you could be asking for trouble especially in a production environment (I trust you are aware of this)

Cook most certainly does not need 777 permissions to complete the upload process
Cook CHMOD Defaults are as follows FOLDERS 744 AND FILES 644 (from memory)

I suspect that it is related to the fact that you have changed the default upload directory (this is not a problem if done correctly)

For example on a windows system when you set the upload directory as you have
/images/xxx it will be located in C:\images\xxx

But the default directory for upload would be similar to
C:\...\...\yourjoomladirectory\components\com_yourcomponent\files\some_fieldname

As we can see these two directories are far different to each other and i suspect this is why you can not locate your uploaded files

So Now How to Set your image directory correctly???

There are a number of predefined "MARKERS" for file upload
[ROOT] Joomla Root
[COM_ADMIN] Component Admin Root
[COM_SITE] Component Site Root
[ADMIN] Administrator root
[IMAGES] Site Images Root
[MEDIAS] Site Media Root

From the Administrator Side Config for your component... hover over the label Upload dir. and you will see the above

Anyhow looks like your trying to upload to the site images directory so the answer is simple
[IMAGES]/xxx

Alternatively you can test upload to default directory by clearing the override in the upload dir. field (leave it blank)

hope it helps
BTB300
Last Edit: 30 Apr 2015 12:25 by BTB300.
The administrator has disabled public write access.
The following user(s) said Thank You: tiagovtg

Data Types - File Upload and Download? 30 Apr 2015 13:01 #12958

  • tiagovtg
  • tiagovtg's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
Hello BTB,

I'm developing on windows 8.1, so actually all permissions are as administrator.

Later I will test in a Linux environment.

I have not changed the directory, this perfect file save location as standard I informed the admin in the indicated field. see attached image.

I moved to [IMAGES] / but not resolved.

thank you
The administrator has disabled public write access.

Data Types - File Upload and Download? 30 Apr 2015 14:53 #12959

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
Hello tiagovtg,
Sorry as I dont know your level of experience / knowledge so please excuse me if i offend when i point out / ask the following
OK Windows has specific permissions for PHP...
Sorry cant remember the exact windows user something like INET_USR must have the correct read / write permissions the the Joomla Directory
although you may be logged on as an administrator does not mean PHP will have the correct permissions

Are you using IIS, apache, or something preconfigured like winamp??
Did you set up configure your web server from scratch yourself using the default configs?

The reason i ask is because last time i set up php.ini using the default file i had to enable a few things... i remember having issues with PHP permissions on windows and I do remember helping one Cook user in the past that had have issues with default winamp php.ini

Do you have access to a production server to test???

As for testing in a Linux environment dont worry about that now...

BTB300
Last Edit: 30 Apr 2015 14:57 by BTB300.
The administrator has disabled public write access.

Data Types - File Upload and Download? 30 Apr 2015 16:59 #12960

  • tiagovtg
  • tiagovtg's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
Hi

I solved part of the problem by reviewing how to write the file name, so now this: {ID}-{DATE(Y)}.{EXT}

The file is correctly recorded in the folder, so using: [IMAGES]/xxxx


But not yet understood how or in the list or on the issue, the person will be able to download the file.
The administrator has disabled public write access.

Data Types - File Upload and Download? 30 Apr 2015 18:31 #12961

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
But not yet understood how or in the list or on the issue, the person will be able to download the file.

Drop the file field in your list view / Layout
hover over the field... until the edit properties icon appears
in the properties dialogue... Link tab... Task / Action... select modal / download / ... / ...
and adjust other options as desired

In Your Item View / Layout
Drop the file field into a FLY view... again hover over the field until edit properties icon appears... again adjust options as desired

BTB300
Last Edit: 30 Apr 2015 18:35 by BTB300.
The administrator has disabled public write access.
The following user(s) said Thank You: tiagovtg

Data Types - File Upload and Download? 30 Apr 2015 19:23 #12962

  • tiagovtg
  • tiagovtg's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
wow nice

I found within the default_grid.php of list view, and add line( 'target' => 'download' )

<?php echo JDom::_('html.fly.file', array(
'dataKey' => 'pdf_representante',
'dataObject' => $row,
'height' => 'auto',
'indirect' => true,
'root' => '[DIR_FORMULARIOS_PDF_REPRESENTANTE]',
'width' => 'auto',
'target' => 'download'
));?>

B)
The administrator has disabled public write access.

Data Types - File Upload and Download? 30 Apr 2015 19:28 #12963

  • tiagovtg
  • tiagovtg's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Karma: 0
Thak you BTB, its solved.
Drop the file field in your list view / Layout
hover over the field... until the edit properties icon appears
in the properties dialogue... Link tab... Task / Action... select modal / download / ... / ...
and adjust other options as desired

Now i go to the next 2 steps, i need Print, save PDF and view another Layout Form.
The administrator has disabled public write access.
Time to create page: 0.092 seconds

Get Started