How to access the directory of an audio file from the HTML audio Tag in linux [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
I have the following audio on linux Centos /var/spool/audios/2023/02/15/202302151100015.mp3. If I configure the full path in the src of the Audio Tag, it doesn't work, for it to work I must copy the audio 202302151100015.mp3 to the directory where I have my web application and place in the src of the audio tag src="202302151100015.mp3" and it works there. What am I doing wrong? I copy part of the code, thanks.
<audio><source src="/var/spool/audios/2023/02/15/202302151100015.mp3"></source></audio> //does not work does not access directories.
<audio><source src="202302151100015.mp3"></source></audio> //It works but I have to first copy the audio file to my app's web folder.
Solution to my question and thus learn

What am I doing wrong?
Your resources cannot reside outside your web directory (starting from it's root.) It's not Linux related and all web servers will (and should) behaves the same or imagine the security hole if one can go any location on your box… Full stop.

Related

How to access the images/videos from another location (windows + disk E) in PHP? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
We have one .net application in which there is facility to upload images in given storage location. our application is completely windows based. and what it does is it stores images on given path for example "E:\Images".
On the other hand We are using using PHP application (using smarty framework) to display all our uploaded data. In this case everything working fine except images as the storage location is not within the PHP application directory.
I know with the help of symbolic link we can access the images from another disk. It is also working. But if we change the storage location later on then there will be a problem.
I also know that using base64 way we can access images. But it is taking too much time to load If I have a 30 images for one single record.
Can you please suggest a good way how can I access the images? Or how we can improve our symbolic link way?
PHP can access any area of the disk ifallowed. You may need to configure open_basedir to allow such access.

PHP how to simply upload video to server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to simply upload a video (MP4) to a folder on the website using PHP and be able to retrieve it. I searched several websites and questions on stackoverflow and all of them have not worked for me.
Without any code examples, it is kinda hard to answer, but here is something you can use as a starting point.
http://www.w3schools.com/php/php_file_upload.asp
Once you can get the file to upload to your PHP script (in temp storage on the server), you can then use PHP functions to move the file to a folder, or insert it into a database.
Be aware, the example is simple, and not super secure. You will want to enforce limiting mime types and file sizes to start.
If you get some code written and have issues, I would suggest updating your question so we can help.
You may run into a few issues with uploading.
Server permissions
File Size Limits
Folder permissions to put the file.
Note: The example I gave you is for images, but just look through it because obviously you can't use
getimagesize()
on a video.
You should be able to use this instead:http://php.net/manual/en/function.filesize.php
I would first focus on getting a basic, secure uploader working. From there you can do specific video stuff.
Good luck.

Run a web app coded in PHP locally [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need help with making a webpage from several files and I am not sure how to go about it. I'm not sure how to follow these instructions can someone help me out.
Install:
Copy contents of folder "upload_to_server" to your server.
Open "includes/config.php" and edit $cfg['db_server'], $cfg['db_username'], $cfg['db_password'], $cfg['db_database'] to be your database details, and $cfg['site_url'] to be the URL to the site with a trailing slash e.g. "http://www.example.com/" or "http://www .example.com/example/" (if it has been uploaded to a sub folder named "example".
Import database.sql into your database
![Here is a picture of the files for the site][1]
[1]: http://i.stack.imgur.com/7eHOb.pn g
You need to install a local web stack first. WAMP or XAMPP for Windows, LAMP for Linux, or MAMP for Mac
You are then going to have to locate your web folder, which is usually called www, htdocs, or public_html. This is where your files need to go.
You can import databases from PhpMyAdmin, which should come bundled with your web stack.
Then you use http://localhost/whatever-folder-you-added to access it.

Git don't track files only upload [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to have files in my repo but don't want to track the changes in the clones is there a way to do that without setting files to assume-unchanged through a deploy script?
Example:
Server bare.git holds a file custom.php
Local repo pulls bare.git gets the custom.php but don't track changes to the file
I read about config files but I don't want to make the files with a deploy script I want the file to be in the repo and gets cloned but not to be tracked by the cloned repo.
No, there is no way of doing this, and there probably a problem with your workflow if you need this. If config.php needs to be changed on each instance (for example, to add credentials specific to that environment), you probably want the following accepted pattern:
Rename that file to config.php.example
Add config.php to .gitignore
In each clone, copy config.php.example to config.php and make the necessary local changes
Otherwise, the entire purpose of Git is to track change to files. If you don't want changes to a file tracked, don't track it.

Automatically saving doc file after 20 secs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i am doing a php program which requires doc file to be saved after every 10 secs.msword should not ask the path to be saved. actually i have written a program which opens a doc file. the file should be auto saved to the exact location from where the file is opened.
If I understand you correctly, what you want to do is not possible (sadly).
There is no standard or protocol for live editing of remote files that have been downloaded from a web page in a browser. The file will be downloaded to a temporary location and opened from there.
Hence, any notion of providing an auto-save mechanism from PHP or JavaScript is completely impossible. The client application will have to do that.
If you want to upload the downloaded and locally edited file back to the web site, you will need to provide an upload form for the user to do it manually. (Which is a shame and completely unintuitive, but that's the way technology is at the moment.)
Not possible due to security reason in web technology.

Categories