I am designing an Admin panel in php which has option to upload file and text both.
I have managed seneraio of text How can I manage file uploading…?
I am facing problem here
suppose in textarea user has inserted a video know I have two seneraios to handle
1)Upload that video file in proper directory
2)Add saved path in database to in place of video src.
How can I manage these senraios ?
Function is same as sitepoint but I want file position saved properly.I need to create JSON further
from this data for android and iOS.
Have a search down this forum, there are lots of file upload scripts that people have required help with that would give you a start on the code. Simply a case of adding an <input type="file"> to your form and dealing with the upload in your PHP code.
Well, you wouldn’t normally put in in a textarea, you’d have a separate input for it. I can’t see how you’d do it from a textarea - you could extract the filename in PHP, but your PHP wouldn’t be able to force the client machine to upload the file for obvious security reasons. Why do you want it from in a textarea rather than doing it the normal way? Or are you talking about some kind of drag-and-drop enhanced text entry box rather than a standard html textarea input?
No I have JQuery code that will add on button click
Only thing I want is to get all files,texts,images in server side in same order and after manipulation on some of them
like changing video file path and some small things store in database and then generate same order based JSON api for android app
Just keep in mind that the text editor in the Sitepoint forum isn’t a textarea. I can’t help any further unfortunately, but I suspect when you select a post editor to use, it will have sample code on how to retain post order and so on.
I believe he is talking about BBcode, but the kind where you can see the actual visiual/ video. So kind of like CKEditor. I believe he wants to be able to place the video and/ or images and move them freely within said text area.
I also don’t believe it is possible to separate what is image and what is text and so forth using PHP because someone can easily attempt to spoof that idea. Someone can do
https://some-random-domain-that-does-not-exist/images/random_picture.pngThis is a text spoof.
And then your PHP Will most likely grab all that text with it. Unless you know a way to do it better. I agree with @droopsnoot. You should have separate fields where you can reference the filename in your blog and embed it that way. That way, you can also have the Json reference the filename without having to try and parse the video or image from the message where it’ll take a lot of effort to do.