11
kerkyra
Re: Uploading files
  • 2008/4/18 8:48

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


bump?
whttp://www.guidemap.gr - Beta is out...

12
Catzwolf
Re: Uploading files
  • 2008/4/18 9:26

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


You have to specify that which mimetypes the uploader explicitelly allow during the upload process or it shall fail. What error are you getting? The more information that you give us the easier it will be for us to help you :)

Catz

13
kerkyra
Re: Uploading files
  • 2008/4/18 9:33

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


this is the form code (the input fields only)
Quote:
$form->addElement(new XoopsFormFile(_MD_AUDIOFILE, 'file', 4194304));
$form->addElement(new XoopsFormText(_MD_TITLE, 'title', 50, 255));
$form->addElement(new XoopsFormTextArea(_MD_DESCRIPTIONC, 'description'));

ob_start();
$mytree->makeMySelBox('format', 'format');
$formattype=new XoopsFormLabel(_MD_PLAYER, ob_get_contents());
ob_end_clean();


and this is how i try to upload the file

Quote:
include_once XOOPS_ROOT_PATH.'/class/uploader.php';
$error =0;

$allowed_mimetypes = array('audio/mpeg', 'audio/x-pn-realaudio','audio/x-wav','video/mpeg','video/quicktime','video/x-msvideo');
$maxfilesize = 4194304;
$maxfilewidth = 600;
$maxfileheight = 650;
$uploader = new XoopsMediaUploader($audiodir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
$lid = $myts->makeTboxData4Save($HTTP_POST_VARS["lid"]);

$title = $myts->makeTboxData4Save($HTTP_POST_VARS["title"]);
$description = $myts->makeTareaData4Save($HTTP_POST_VARS["description"]);
$formatid = intval($myts->makeTareaData4Save($HTTP_POST_VARS["formatid"]));

if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) {
if (!$uploader->upload()) {
echo $uploader->getErrors();
} else {
echo '

File uploaded successfully!

';
echo 'Saved as: ' . $uploader->getSavedFileName() . '
';
echo 'Full path: ' . $uploader->getSavedDestination();
$name=$uploader->getSavedFileName();
}
whttp://www.guidemap.gr - Beta is out...

14
Catzwolf
Re: Uploading files
  • 2008/4/18 9:46

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Try adding these to the list:

audio/mpeg
audio/x-mpeg
audio/mp3
audio/x-mp3
audio/mpeg3
audio/x-mpeg3
audio/mpg
audio/x-mpg
audio/x-mpegaudio

does it work on your test box or just not at all, and do you get any error reported back when trying to upload these types of files? Has your server disabled these types of files?

Catz

15
kerkyra
Re: Uploading files
  • 2008/4/18 12:18

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


The error msg is "There were errors - No file loaded." With the same form i'm able to upload wav files or images (adding the correct file types.). Also i am able to upload mp3 files through ftp so i dont think its a server permissions problem.

I'm using the XOOPS mimetypes.inc.php file. and these types are not included.

the mp3 file is declared as "mp3"=> "audio/mpeg"

I will add them and see whats going on.

Thanks for your help mate.
whttp://www.guidemap.gr - Beta is out...

16
kerkyra
Re: Uploading files
  • 2008/4/18 12:30

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


i did added those mimetypes to my php file and the same happens! do i have to add them to mimetypes.inc.php also?
whttp://www.guidemap.gr - Beta is out...

17
Catzwolf
Re: Uploading files
  • 2008/4/18 13:38

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


It could be a few things, possible upload limit in php? What size is the mp3 files you are trying to upload?

Things to check for:

1. Max Post files size. Trying increasing this size.
2. Max File upload Size. Same as above.
3. Does your server allow mp3 files? ie have they disallowed uploading mp3 files?

18
kerkyra
Re: Uploading files
  • 2008/4/18 14:25

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


i dont get it!! It seems to be a limit to the file size up to 2MBs. The servers limit is up to 10 MB and the upload class is initiated with 4 MB max file size (as seen in the code above). Yet when i try to upload a wav file more than 2 mbs it gives me that error!
whttp://www.guidemap.gr - Beta is out...

19
Catzwolf
Re: Uploading files
  • 2008/4/18 21:52

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


You may have to increase the following to get it to work:

'post_max_size'
'upload_max_filesize'

Ok, there are a few ways you can increase these sizes:

1. php.ini file: If you have access to this file on your server then do it this way, if not:
2. Add the following lines somewhere around the top of your script or in XOOPS_ROOT_PATH.'/common.php'

Quote:

ini_set('post_max_size', '10M');
ini_set('upload_max_filesize', '10M');


3. In your .htaccess file: (in the XOOPS main dir)

Quote:

php_value post_max_size 10M
php_value upload_max_filesize 10M


Try these and see if it helps you out.

20
kerkyra
Re: Uploading files
  • 2008/4/19 18:53

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


there was a server limit! I did ask about it in the firt place and told me that this was increased to 20MB! I had to contact them for a second time to do that properly! At least now its working fine! Thanks for your help catz! Appreciate it mate. :)
whttp://www.guidemap.gr - Beta is out...

Login

Who's Online

201 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 201


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits