Jump to content

Recommended Posts

I have 2 things I am trying to do, but I don't understand where to start.
I have to get files to embed into a page when they are uploaded, and have to have the filename as the url.
For instance if someone names the file ants
it would be accessed through
www.funnyemailforwards.com/ants
I need to figure out how to get them all to appear like this but I don't understand how, I also don't understand how to set up the files to embed automatically each time they are uploaded based on filetype?
[move]Thanks for the help.[/move]
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/
Share on other sites

I don't fully understand what you mean by 'embed' a file into a page. You can use include() to insert another scripted/plain text file within your page...

With regards to your URL structures, you can do that with an Apache module called mod_rewrite, searching the forums or checking out the documentation over at apache.org should help you out with that.
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52455
Share on other sites

Oh, I understand now. There is no 'global' way of embeding media files into a webpage as each different type of media file is embeded slightly different.

For example, you can embed a video file, within a Windows Media Player window with the following code:
[code]<object id='MediaPlayer' width='292px' height='290px' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Windows Media Player components...' type='application/x-oleobject'>
    <param name='FileName' value='videos/$row[filename]'>
    <param name='ShowControls' value='true'>
    <param name='ShowStatusBar' value='false'>
    <param name='ShowDisplay' value='false'>
    <param name='autostart' VALUE='false'>
    <embed type='application/x-mplayer2' src='videos/$row[filename]' name='MediaPlayer' width='292px' height='290px' ShowControls='1' ShowStatusBar='0' ShowDisplay='0' autostart='0'>
    </embed>
</object>[/code]

If you do a bit of a search on Google it's pretty straight forward to find out how to include other types of media, aswell as the list of other parameters you can use in the above example.
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52473
Share on other sites

That helped a lot, now the one thing I don't understand is how to make the embedded page, have a relation to the uploaded specific file.  Seeing that each file will be in the directory, and each one will have a different name, what prevents from the txt file I have over here called funnypoem, from accidentally attempting to embed itself in a windows media player page.  I don't understand how to make the embedded pages to be exactly related to the uploaded files.  Because on each individual page, I need the file imbedded, and to create a link on each file, so that people can click the link and have it download the file incase they don't have the proper plugin.
I know this is a lot, but when I get only 1 txt file, all I need to do with txt files is have them display, how is it going to know not to try and have a download link too, this is the best way to explain what I Don't understand, I am confused, and have tried to explain it before, but maybe that helped.
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52523
Share on other sites

This tutorial [url=http://www.onlamp.com/pub/a/php/2003/01/09/php_foundations.html]here[/url] shows you how to read files in a directory.

But to see whether a file is a PHP file or a TXT file I'd use the substr to get the last four characters from the filename. Then I'd use str_replace to remove the period (.) from the string. Now That I have just the extension I'd use if statment to see whether extension is equal to txt or use in_array to check the file extension again multiple file extensons.
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52532
Share on other sites

Thanks before I ask any more questions related to this, I am going to step back and look over all this advice, and the tutorial and see if I have enough tools and knowledge now to get this done, thanks a lot for the help, I have a deeper understanding of what I am doing now, before I start digging into it too deep, thanks again.
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52535
Share on other sites

I finished a high school project on a site it involved videos and streaming, i used the standered html enbeded method and gess what the client wanted a better solution, the problam was that when the user moved the page up and down the browser would destalt the video in the page.

In the end i enbeded a flash video viewer but know the complant is that users got to install flash.

didnt fine a way around it,  so if you bussiness man do get a nice sharp video player enbeded that works on most file exstentions please let me know cheers.



heres an example of html method/php.

Your also notice i added apic if the user has not got a video ok.

good luck.

  <?

$video_query="SELECT * from members_video_uploads where id='$id'";
$video_result=mysql_query($video_query);

while($vid=mysql_fetch_assoc($video_result)) {



?>


<td  align="center"><b>members video</b><br><br>

<object
width="125" height="125" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" id="mediaplayer1">
<param name="filename" value="members_video/<?echo $vid["userfile_name"];?>">
<param name="AutoStart" value="false">
<param name="ShowControls" value="true"><br>
<param name="ShowStatusBar" value="False">
<param name="ShowDisplay" value="false">
<param name="AutoRewind" value="True">

<embed type="application/x-mplayer2"
filename="kids.mpg" autostart="True"
showcontrols="True" showstatusbar="False"
showdisplay="False" autorewind="True">
</embed></object>


<?
}
if(mysql_num_rows($video_result)==0){
echo'
<td  align="center"><b>members video</b><br><br><img width="125" height="125" src="images/novid.png"></img>';
}

?>
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52545
Share on other sites

What I don't understand is how to write to the file.  Like if a video file get's uploaded, how do I automatically have php create a page for it, and have the stuff in the page I need for it to work, and have a filename, I don't know how to do this, but then if it ends up being just a txt file, have it create a .php filet hat just shows the file information, just created pages with php, one page for each file type, so I can also generate a link, and have it save the new page in a directory with all the proper information:S:S
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52911
Share on other sites

What I mean is this
I want to have this all in one page
I noticed how if you upload files, a script can move the file, or whatever, it can even create files out of nowhere like pdf's or whatever.  The thing I am wondering, is I can have like this, now that I have my extensions, I can have something for like
if (fileextension = "this, this, and this") or whatever
then I can have my stuff here, and have my php script create a .php page, and name it the filename the person gives it .php, then have that create the proper tags, like if it's text, i can have the otehr file just create the necessary tags to imbed, and put them in there, then have it create a download link, or whatever, is this a possibility.
Link to comment
https://forums.phpfreaks.com/topic/13547-2-questions/#findComment-52913
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.