Mpesa Mini Program Pdf choose from gallery issue - javascript

i am trying to upload a pdf in mini program studio i am able to choose image using from gallery
my.chooseImage({ count: 1, success: (res) => { console.log(res); }, });
console of above code is
apFilePaths: ["https://resource/apml670e637a119d9fac0d058e05f48ec13b.jpg"]
but i am not able to find any way of selecting pdf from gallery if i try to fetch pdf using chooseImage it return this
apFilePaths: ["https://resource/apmla02211d90601062735fa0962063f59a6.null"]
Is there any way of choosing pdf or documents in Mpesa Mini program

IOS is not allow to upload file ,it only can upload picture and video form gallery .So the app and mini-program cloud not do it yet.
Maybe you can try to use api "chooseMessageFile".But it only choose file from wechat cache file.

Related

Drag and Drop from ReactJS with external URL

I have an React/Electron app that shows remote files that are stored on the cloud. I would like to allow users to drag and drop these files from my app into other applications, such as Dropping into the Windows Desktop, or into Outlook Draft Email or paste into Slack. I have been following the Electron tutorial for native file drag and drop, which works if the file is stored on disk. Now, a really quick workaround exists in the tutorial, I can create a temporary file on disk and have a WriteStream write to the disk using an http request, something like:
const file = path.join(__dirname, 'picture.jpg');
const fileStream = fs.createWriteStream(file);
https.get('https://website.com/picture.jpg', (response) => {
response.pipe(fileStream);
});
...
document.getElementById('remote_file').ondragstart = (event) => {
event.preventDefault()
window.electron.startDrag('picture.jpg')
}
which is all fine and dandy, except that there might be hundreds of files being rendered on screen, I don't want to write all of these to disk. In addition, what do I do if the file is pretty large and can't be downloaded in that time? I would like the functionality to basically begin downloading the file from disk when the dragStart event handler is called and make sure that the drop operation happens once the file is downloaded from the cloud.
I also tried using JS's drag and drop on the React component:
onDragStart={(e) => {
e.dataTransfer.setData("DownloadURL", [
"application/octet-stream:picture.jpg:https:website.com/image.jpg",
]);
}
which at least allows me to drag and drop the file into the windows desktop and file explorer. However, this doesn't work when trying to drag it into something like google drive, slack, or an outlook draft email.
Link to Electron Native Drag and Drop tutorial: https://www.electronjs.org/docs/latest/tutorial/native-file-drag-drop#native-file-drag--drop

How do I handle OS generated pop up using webdriverio if there is not input(type=file)

How do I upload image using WebdriverIO if there is not input(type=file). I'm trying to automaticale upload image on this site.
https://userinyerface.com/game.html Form 2
Is there a way to upload file if iput(type=file) is created dynamically?
https://i.stack.imgur.com/1FzAS.png

CollectionFS and CFS-S3 Meteor small help needed

I created a simple site to handle uploads with collectionFS, http://uploadapp.meteor.com/, when I click on upload it uploads the file to my AS3 bucket but if I click on the uploaded image in the site and copy url it gives me a local url example:
http://uploadapp.meteor.com/cfs/files/videos/tn877RSLTC2S6SnwG/download%20(1).jpeg?token=eyJhdXRoVG9rZW4iOiJHYkpZVkZ4V0dOLUlCQmJPbzdrdUxxS3VuQ3FDWDFBOUtSNzBBV1p3X0t3In0%3D
this means that the image is showing uploading to the mongodb and to as3?
how can I make it show and upload only and directly from AS3? (the images are stored to the as3 bucket so the upload is working)
The event handler for the upload form is :
Template.hello.events({
'change .fileInput':function(evt,tmpl){
FS.Utility.eachFile(event,function(file){
var fileObj = new FS.File(file);
Videos.insert(fileObj),function(err){
console.log(err);
}
})
}
});
The URL is simply a proxy to the actual image. The reason it's like this is it needs to sign the url to be displayed.
It's not actually on your mongodb its only on S3.

How to open the window multiple times and download the file in main window using jquery

I want to download multiple files based on the user requirement. if the user want to download three files then i am repeating the for loop and opening the windows and downloading the files. but the first file is saving in main window afterwards the files are downloading in the newly opened windows.
Code:
for(var i=0;i<data.length;i++)
{
// this is the url where i am downloading the image
var win = window.open("/Profiles/GetImage");
window.close();
}
How to download all the files at the first window
You can put required files (images) in zip container on server-side. I don't think its possible to achieve it on client-side. User can download zip and unzip on desktop. It can done on server-side. For example in php you can use the below example for zip:
http://davidwalsh.name/create-zip-php
Create zip with PHP adding files from url
May be someone know the solution from client-side.

How to open local file from Tide SDK app

I am building an windows app using Tide SDK. How can I open a local file from my app. For example, I have a pdf file somewhere in my harddisk. I put the link to that file to my app. When I click on the link, I want it to open the pdf file using default programm associated with pdf type file.
If it is not possible then I have one more general question. Is it possible to access local file system by any app that built using html5 and javascript?
we can access local file system in tidesdk application.
See the following code.
var contents;
var file= 'test.txt';
var Dir = Ti.Filesystem.getUserDirectory();
var readfi= Ti.Filesystem.getFile(Dir, file);
if (readfi.exists())
{
var Stream = Ti.Filesystem.getFileStream(readFi);
Stream.open(Ti.Filesystem.MODE_READ);
contents =Stream.read();
alert( contents );
Stream.close();
}
The above code will read the text file and alert the content. Visit here to know tidesdk file system.
Following code will open the given URL in default browser.
Ti.Platform.openURL('http://stackoverflow.com');
Following code will Open the given application or file in the system's default program.
Ti.Platform.openApplication('C:/Documents and Settings/Thavamani00/Desktop/readme.txt');
Ti.Platform.openApplication('C:/Documents and Settings/Thavamani00/Desktop/cart15.png');
The above code displays the text file in notepad and displays the image in mircosoft picture manager.
it works well for me.i hope its your required answer.

Categories