Upload audio file to Jodit - upload

I'm trying to configure my Jodit editor (v.3.0) in order to be able to upload also audio files.
I've put
$config['extensions'} = ['jpg', 'png', 'gif', 'jpeg', 'wav', 'mp3'];
in my config file and it stopped giving me the error "File type is not in white list", but it doesn't appear to execute any action.
What can I try?
Thanks

First you've closed the extensions array key with a } but I think is just a mistype
For the issue: I've figure out that the mp3 I'm trying to load is actually an mpeg file, even if the extension is .mp3
How to test: got to your connector, open the file connector>vendor>jodit>application>src>components>BaseApplication.php and comment out all the "if" statement with 'File type is not in white list' (for me is near line 365).
Now try to upload the file and you'll see the real extension. Mine was mpeg and after removing the comments to the BaseApplication.php file and adding the mpeg extention to the config.php the file was uploaded as expected.
Hope this can help you and a others (even my future me searching this issue again hehehe)

Related

PHPEXCEL weird characters on form inputs

I need some help with PHPEXCEL library, everything works great, I'm successfully extracting my SQL query to excel5 file, I need to give this file to transport company in order to auto collect informations about packages, unfotunately the generated excel file has some ascii characters between each letter of the cell text, and when the excel file is imported you need to manually delete these charaters.
If I open the excel file, everything is fine I see: COMPANY NAME, If I open the excel file with notepad++, I see the cell values this way: C(NUL)O(NUL)M(NUL)P(NUL)A(NUL)N(NUL)Y N(NUL)A(NUL)M(NUL)E
If I open again the file with excel and save, then reopen with notepad++ I see COMPANY NAME.
So I do not understan why every time I create an excel file using PHPEXCEL my every letter of all words are filled with (nul) every letter.
So how do I prevent the generated excel file to include (nul) between every word????
Also if you open the original excel file generated from PHPExcel samples are also filled with (nul) and if you open and save it, the (nul) is gone.
Any help would be appreciated, thanks.
what is the (nul) ??? 0x00??? char(0)???
ok, here is the example:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');
if (PHP_SAPI == 'cli')
die('Disponibile solo su browser');
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Solidus")
->setLastModifiedBy("Solidus")
->setTitle("Import web")
->setSubject("Import File")
->setDescription("n.a")
->setKeywords("n.a")
->setCategory("n.a");
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueExplicit("A1", "COMPANY")
->setCellValue('A2', 'SAMSUNG');
$objPHPExcel->getActiveSheet()->setTitle('DDT');
$objPHPExcel->setActiveSheetIndex(0);
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="TEST.xls"');
header('Cache-Control: max-age=0');
header('Cache-Control: max-age=1');
header('Cache-Control: private',false);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
ob_end_clean();
$objWriter->save('php://output');
As you can see from this little example, this scripts creates a file excel5 with 2 cells, A1 = COMPANY, A2 = SAMSUNG
when I send this file to the transport company, they import the file into their system, but as you can see from the picture, there is an weird character between each letter.
so I noticed every time I open the generated Excel5 with notepad++ file I get:
S(nul)A(nul)M(nul)S(nul)U(nul)N(nul)G
If I save the save with excel and then open it again with notepad++ I get:
SAMSUNG
and this file is ok for the transport company
so my question is, how should I avoid the file generated to contain thi '(nul) charachter between each letter????
some help?
weird characters
SAMSUNG
I found the soluion by myself, I explain just in case anyone has also this problem:
there is not way to change the way the excelfile is encoded by PHPEXCEL
so I figured out the problem was reading the file, I did some simulations and reproduce the problem, every time a read the file and put the result into inputs a get weird characters:
C�O�M�P�A�N�Y�
If I set the output enconding enconding as follows:
$excel->setOutputEncoding('UTF-8');
the file loads fine, so the problem was not creating the excel file, but reading the excel file.
If I print the variable with ECHO I get: "COMPANY",
if I put the variable on input as value I get: "C�O�M�P�A�N�Y�"
setting the output solves the problem, but I would like to know why the difference when I put the variable on input as value, thanks

Downloaded image file is corrupt

I'm making a simple Lua script to download images. I get the URL of the image, and then this is my code to download it:
content = http.request(imageurl)
file = io.open("E:\\Users\\Me\\Documents\\Lua\\IMGDownload\\output.jpg", "w")
file:write(content)
print("Wrote content")
I get a 4KB file, however it isn't what I want it to be.
For reference, here is the image that I want to download:
RealImage http://cdn.akamai.steamstatic.com/steamcommunity/public/images/avatars/bd/bd05e23129b5d03ecb3f933589ff1477fbff4e92_full.jpg
This is what I actually get:
Can anyone pinpoint me as to the cause?
You probably just need to open the file with "wb" mode to get Windows to open the file in binary mode and not do line-ending conversion on you.
Try io.open("E:\\Users\\Me\\Documents\\Lua\\IMGDownload\\output.jpg", "wb").

cvCaptureFromFile always returns NULL, Visual Studio 2005

I've got a problem with the cvCaptureFromFile function. It always returns NULL. I've done some research on the internet and I've added PATH to ffmpeg's "bin" directory.
But it's still the same. So I've tried to open the desired file with ffplay.exe. It returns an error which says "Invalid data found when processing an input". It is a "mjpg" file, which should be played with ffmpeg. Then I tried the same with some "mpg" file.
Now the message is "no such file or directory" which is not true, because the file is in the place. What else should I do?
The files all right with Media-Player and VLC player.
Please help!

XNA error - file not found

I am working on XNA with XML reading. While I'm debugging the code its shows file not found error, but I added my XML file in Content reference folder. While I'm using this code I got the error.
System.IO.Stream stream = TitleContainer.OpenStream("ProductSchema");
Thanks in advance.
Bharathi.G
Shawn explains this very well in this post: Shawn's blog entry
Try adding the extension:
System.IO.Stream stream = TitleContainer.OpenStream("ProductSchema.xml");
Check whether that file is present in the bin folder where your game .exe file lives (bin\Windows Phone\Debug\Content). If not, then this may be the problem. To solve this :
right click the file >> select property >> change build action to None and copy to output directory to Copy if newer.
This works for me while loading/reading binary files in my game.

How do I use a custom AVI with TAnimate?

I have an AVI file that I pulled from shell32 using Resources Extract. I would like to use this with TAnimate but I can't figure out how to load this file.
I succesfully loaded the AVI into a .RES file using DelphiDabbler's rcdatacreator program (you have to download the "worked example" to get rcdatacreator. However, my issue now is figuring out how to extract the AVI file from the .RES and supplying it to TAnimate.
I am using Delphi 2010:
Any help is appreciated.
As Andreas mentioned (in his now deleted answer), you don't need to use an external tool to add the resource in recent versions of Delphi.
Use Project/Resources and Images... from the IDE menu. Add a new resource by browsing to the folder your .AVI file is in, give it a name, and type in AVI for the Resource Type. (It's not in the list, but you can add it.)
At runtime, use the following code:
// I used CoolAVI as the resource name in my image above,
// so that's the name I need to use here.
Animate1.ResName := 'COOLAVI';
Animate1.Active := True;

Resources